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];
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);
}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {

View File

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