diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index aa99d637..4b6c3536 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -122,15 +122,21 @@ export class PollService implements Resolve { } let keyToTranslate = stepsTitle[kind][(step_current - 1) | 0]; - this.translate.get(keyToTranslate).subscribe( - (resp) => { - this.titleService.setTitle(environment.appTitle + ' - ' + resp + ' - ' + this.form.value.title); - }, - (err) => { - console.error(err); - this.toastService.display(err.message); + this.translate.getTranslation(this.translate.getBrowserLang()).subscribe((response) => { + let step = this.translate.getParsedResult(response, 'nav.step'); + let on = this.translate.getParsedResult(response, 'nav.on'); + let no_title = this.translate.getParsedResult(response, 'nav.no_title'); + let titleText = this.form.value.title ? ' - ' + this.form.value.title : no_title + ' -'; + let stepTitle = this.translate.getParsedResult(response, keyToTranslate); + if (this.step_current == 1) { + titleText = stepTitle; } - ); + console.log('a', step, this.translate.getBrowserCultureLang()); + let fullTitle = `${titleText} ${step} ${this.step_current} ${on} ${this.step_max} - ${environment.appTitle} `; + console.log('fullTitle', fullTitle); + // ex: Nom de mon sondage - étape 3 sur 7 - Framadate + this.titleService.setTitle(fullTitle); + }); } else { this.titleService.setTitle(apptitle); } diff --git a/src/app/features/administration/form/steps/step-one/step-one.component.ts b/src/app/features/administration/form/steps/step-one/step-one.component.ts index 0158964f..083fe450 100644 --- a/src/app/features/administration/form/steps/step-one/step-one.component.ts +++ b/src/app/features/administration/form/steps/step-one/step-one.component.ts @@ -27,14 +27,6 @@ export class StepOneComponent implements OnInit { ) { this.step_max = this.pollService.step_max; this.pollService.step_current = 1; - this.titleService.setTitle( - ' Création de sondage - Étape ' + - this.pollService.step_current + - ' sur ' + - this.pollService.step_max + - ' ' + - environment.appTitle - ); } ngOnInit(): void {} diff --git a/src/app/features/administration/form/steps/step-three/step-three.component.ts b/src/app/features/administration/form/steps/step-three/step-three.component.ts index 5bbc0cc9..ec107202 100644 --- a/src/app/features/administration/form/steps/step-three/step-three.component.ts +++ b/src/app/features/administration/form/steps/step-three/step-three.component.ts @@ -28,14 +28,6 @@ export class StepThreeComponent implements OnInit { this.pollService.step_current = 3; this.step_max = this.pollService.step_max; - this.titleService.setTitle( - ' Création de sondage - Étape ' + - this.pollService.step_current + - ' sur ' + - this.pollService.step_max + - ' ' + - environment.appTitle - ); } ngOnInit(): void {} diff --git a/src/app/features/administration/form/steps/step-two/step-two.component.ts b/src/app/features/administration/form/steps/step-two/step-two.component.ts index 0653835e..7256abb3 100644 --- a/src/app/features/administration/form/steps/step-two/step-two.component.ts +++ b/src/app/features/administration/form/steps/step-two/step-two.component.ts @@ -46,14 +46,6 @@ export class StepTwoComponent implements OnInit { this.form = this.pollService.form; this.pollService.step_current = 2; this.step_max = this.pollService.step_max; - this.titleService.setTitle( - ' Création de sondage - Étape ' + - this.pollService.step_current + - ' sur ' + - this.pollService.step_max + - ' ' + - environment.appTitle - ); } get choices(): FormArray { diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 67aa0787..ecb84f1d 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -17,7 +17,7 @@ "previous": "Previous", "next": "Next", "step": "Step", - "on": "on", + "on": "of", "no_title": "(no title)", "remove": "Remove", "save": "Save"