translate step content, change order of words in title

This commit is contained in:
Tykayn 2022-03-01 10:46:09 +01:00 committed by tykayn
parent bfe427b85a
commit 6ab5c18174
5 changed files with 15 additions and 33 deletions

View File

@ -122,15 +122,21 @@ export class PollService implements Resolve<Poll> {
} }
let keyToTranslate = stepsTitle[kind][(step_current - 1) | 0]; let keyToTranslate = stepsTitle[kind][(step_current - 1) | 0];
this.translate.get(keyToTranslate).subscribe( this.translate.getTranslation(this.translate.getBrowserLang()).subscribe((response) => {
(resp) => { let step = this.translate.getParsedResult(response, 'nav.step');
this.titleService.setTitle(environment.appTitle + ' - ' + resp + ' - ' + this.form.value.title); let on = this.translate.getParsedResult(response, 'nav.on');
}, let no_title = this.translate.getParsedResult(response, 'nav.no_title');
(err) => { let titleText = this.form.value.title ? ' - ' + this.form.value.title : no_title + ' -';
console.error(err); let stepTitle = this.translate.getParsedResult(response, keyToTranslate);
this.toastService.display(err.message); 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 { } else {
this.titleService.setTitle(apptitle); this.titleService.setTitle(apptitle);
} }

View File

@ -27,14 +27,6 @@ export class StepOneComponent implements OnInit {
) { ) {
this.step_max = this.pollService.step_max; this.step_max = this.pollService.step_max;
this.pollService.step_current = 1; 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 {} ngOnInit(): void {}

View File

@ -28,14 +28,6 @@ export class StepThreeComponent implements OnInit {
this.pollService.step_current = 3; this.pollService.step_current = 3;
this.step_max = this.pollService.step_max; 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 {} ngOnInit(): void {}

View File

@ -46,14 +46,6 @@ export class StepTwoComponent implements OnInit {
this.form = this.pollService.form; this.form = this.pollService.form;
this.pollService.step_current = 2; this.pollService.step_current = 2;
this.step_max = this.pollService.step_max; 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 { get choices(): FormArray {

View File

@ -17,7 +17,7 @@
"previous": "Previous", "previous": "Previous",
"next": "Next", "next": "Next",
"step": "Step", "step": "Step",
"on": "on", "on": "of",
"no_title": "(no title)", "no_title": "(no title)",
"remove": "Remove", "remove": "Remove",
"save": "Save" "save": "Save"