Skip to content

Commit

Permalink
translations added
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Panico committed Dec 5, 2023
1 parent b312a9f commit 68aeeb5
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

<cds-detail-import-export *ngIf="activeSection===SETTINGS_SECTION.IMPORT_EXPORT"
[id_faq_kb]="selectedChatbot?._id"
[faqKb_name]="faqKb_name">
[faqKb_name]="faqKb_name"
[translationsMap]="translationsMap">
</cds-detail-import-export>

<cds-detail-community *ngIf="activeSection===SETTINGS_SECTION.COMMUNITY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,28 @@ export class CdsChatbotDetailsComponent extends BotsBaseComponent implements OnI
let keys = [
'CDSSetting.UpdateBotError',
'CDSSetting.UpdateBotSuccess',
'CDSSetting.Not a valid JSON file.',
'CDSSetting.NotAValidJSON',
'CDSSetting.AnErrorOccurredWhilDeletingTheAnswer',
'CDSSetting.AnswerSuccessfullyDeleted',
'Done',
'CDSSetting.ThereHasBeenAnErrorProcessing'
'CDSSetting.ThereHasBeenAnErrorProcessing',
'CDSSetting.FileUploadedSuccessfully',
'CDSSetting.AnErrorOccurredUpdatingProfile',
'CDSSetting.UserProfileUpdated'

]

this.translate.get(keys).subscribe((text)=>{
this.translationsMap.set('CDSSetting.UpdateBotError', text['CDSSetting.UpdateBotError'])
.set('CDSSetting.UpdateBotSuccess', text['CDSSetting.UpdateBotSuccess'])
.set('CDSSetting.Not a valid JSON file.', text['CDSSetting.Not a valid JSON file.'])
.set('CDSSetting.NotAValidJSON', text['CDSSetting.NotAValidJSON'])
.set('CDSSetting.AnErrorOccurredWhilDeletingTheAnswer', text['CDSSetting.AnErrorOccurredWhilDeletingTheAnswer'])
.set('CDSSetting.AnswerSuccessfullyDeleted', text['CDSSetting.AnswerSuccessfullyDeleted'])
.set('Done', text['Done'])
.set('CDSSetting.ThereHasBeenAnErrorProcessing', text['CDSSetting.ThereHasBeenAnErrorProcessing'])
.set('CDSSetting.FileUploadedSuccessfully', text['CDSSetting.FileUploadedSuccessfully'])
.set('CDSSetting.ThereHasBeenAnErrorProcessing', text['CDSSetting.AnErrorOccurredUpdatingProfile'])
.set('CDSSetting.ThereHasBeenAnErrorProcessing', text['CDSSetting.UserProfileUpdated'])

})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,12 @@ export class CDSDetailCommunityComponent implements OnInit {
}, (error) => {
this.logger.error('[CDS-DETAIL-COMMUNITY] UPDATE USER PROFILE - ERROR ', error);
// =========== NOTIFY ERROR ===========
this.notify.showWidgetStyleUpdateNotification('An error occurred while updating your user profile', 4, 'report_problem');
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('CDSSetting.AnErrorOccurredUpdatingProfile'), 4, 'report_problem');

}, () => {
this.logger.log('[CDS-CHATBOT-DTLS] UPDATE USER PROFILE - * COMPLETE *');
// =========== NOTIFY SUCCESS===========
this.notify.showWidgetStyleUpdateNotification('User profile updated successfully', 2, 'done');
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('CDSSetting.UserProfileUpdated'), 2, 'done');

})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,12 @@ export class CDSDetailBotDetailComponent extends BotsBaseComponent implements On


// =========== NOTIFY ERROR ===========
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('UpdateBotError'), 4, 'report_problem');
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('CDSSetting.UpdateBotError'), 4, 'report_problem');

}, () => {
this.logger.log('[CDS-CHATBOT-DTLS] EDIT BOT LANG - * COMPLETE *');
// =========== NOTIFY SUCCESS===========
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('UpdateBotSuccess'), 2, 'done');
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('CDSSetting.UpdateBotSuccess'), 2, 'done');
this.updateChatbot(this.selectedChatbot, langCode)
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class CDSDetailImportExportComponent implements OnInit {

@Input() id_faq_kb: string;
@Input() faqKb_name: string;
@Input() translationsMap: Map<string, string> = new Map();

displayImportModal = 'none';
displayInfoModal = 'none';
Expand Down Expand Up @@ -111,7 +112,7 @@ export class CDSDetailImportExportComponent implements OnInit {
}, (error) => {
this.logger.error('[TILEBOT] - IMPORT CHATBOT FROM JSON- ERROR', error);

this.notify.showWidgetStyleUpdateNotification("CDSSetting.ThereHasBeenAnErrorProcessing", 4, 'report_problem');
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('CDSSetting.ThereHasBeenAnErrorProcessing'), 4, 'report_problem');
}, () => {
this.logger.log('[TILEBOT] - IMPORT CHATBOT FROM JSON - COMPLETE');
});
Expand Down Expand Up @@ -145,10 +146,10 @@ export class CDSDetailImportExportComponent implements OnInit {
}, (error) => {
this.logger.error('[TILEBOT] - IMPORT INTENTS FROM JSON- ERROR', error);

this.notify.showWidgetStyleUpdateNotification("CDSSetting.ThereHasBeenAnErrorProcessing", 4, 'report_problem');
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('CDSSetting.ThereHasBeenAnErrorProcessing'), 4, 'report_problem');
}, () => {
this.logger.log('[TILEBOT] - IMPORT INTENTS FROM JSON - * COMPLETE *');
this.notify.showWidgetStyleUpdateNotification("CDSSetting.FileUploadedSuccessfully", 2, 'done');
this.notify.showWidgetStyleUpdateNotification(this.translationsMap.get('CDSSetting.FileUploadedSuccessfully'), 2, 'done');

this.onCloseImportJSONModal();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Router } from '@angular/router';
import { MatDialog } from '@angular/material/dialog';


import { NotifyService } from 'src/app/services/notify.service';
import { MultichannelService } from 'src/app/services/multichannel.service';
import { AppConfigService } from 'src/app/services/app-config';
import { FaqKbService } from 'src/app/services/faq-kb.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AppConfigService } from 'src/app/services/app-config';
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
import { TranslateService } from '@ngx-translate/core';

@Component({
selector: 'appdashboard-cds-publish-on-community-modal',
Expand Down Expand Up @@ -49,6 +50,7 @@ export class CdsPublishOnCommunityModalComponent implements OnInit {
private uploadService: UploadService,
private sanitizer: DomSanitizer,
private notify: NotifyService,
private translate: TranslateService,
) {
this.logger.log('[PUBLISH-ON-COMMUNITY-MODAL-COMPONENT] data ', data)
this.selectedChatbot = data.chatbot;
Expand Down Expand Up @@ -292,7 +294,7 @@ export class CdsPublishOnCommunityModalComponent implements OnInit {
}, () => {

this.logger.log('[PUBLISH-ON-COMMUNITY-MODAL-COMPONENT] publishOnCommunity * COMPLETE * ');
this.notify.showWidgetStyleUpdateNotification('CDSSetting.SuccessfullyDeployed', 2, 'done');
this.notify.showWidgetStyleUpdateNotification(this.translate.instant('CDSSetting.SuccessfullyDeployed'), 2, 'done');
this.dialogRef.close('has-published-on-cmnty');

});
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@
"AnErrorOccurredDuringTheUpload": "An error occurred during the upload",
"InTheCSVFileToBeUploadedTheColumnsAreSeparatedBy": "In the CSV file to be uploaded, the columns are separated by",
"UpdateBotError": "An error occurred while updating the bot",
"UserProfileUpdated":"User profile updated successfully",
"AnErrorOccurredUpdatingProfile":"An error occurred while updating your user profile",
"Not a valid JSON file.": "Not a valid JSON file",
"UpdateBotSuccess": " bot successfully updated",
"AnErrorOccurredWhilDeletingTheAnswer": "An error occurred while deleting the Answer",
Expand Down

0 comments on commit 68aeeb5

Please sign in to comment.