From a438bdff6cf54673adc44015e83e564eeeb2d8c8 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 8 Nov 2021 10:26:16 +0100 Subject: [PATCH] translate calendar elements from app init --- src/app/app.component.ts | 7 + src/app/core/services/language.service.ts | 4 + .../step-three/step-three.component.html | 5 + src/assets/i18n/FR.json | 125 ++++++++++++------ src/styles/partials/_forms.scss | 6 + 5 files changed, 109 insertions(+), 38 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d9eb0ee9..8e3001a4 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -13,6 +13,8 @@ import { ShortcutEventOutput, ShortcutInput } from 'ng-keyboard-shortcuts'; import { PollService } from './core/services/poll.service'; import { Poll } from './core/models/poll.model'; import { PollDTO } from './core/models/poll.DTO.model'; +import { PrimeNGConfig } from 'primeng/api'; +import { Language } from './core/enums/language.enum'; @Component({ selector: 'app-root', @@ -37,6 +39,7 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit { private titleService: Title, private themeService: ThemeService, private pollService: PollService, + private config: PrimeNGConfig, private languageService: LanguageService // private mockingService: MockingService ) {} @@ -51,6 +54,10 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit { } ngOnInit(): void { + this.languageService.getPrimeNgStrings().subscribe((resp) => { + this.config.setTranslation(resp); + }); + this.printpath('', this.router.config); this.router.events.subscribe((evt) => { if (!(evt instanceof NavigationEnd)) { diff --git a/src/app/core/services/language.service.ts b/src/app/core/services/language.service.ts index ba481e0c..d13f559e 100644 --- a/src/app/core/services/language.service.ts +++ b/src/app/core/services/language.service.ts @@ -37,6 +37,10 @@ export class LanguageService { this.setLanguageOnInit(); } + public getPrimeNgStrings() { + return this.translate.get('calendar_widget'); + } + private setLanguageOnInit(): void { // set language from storage if (!this.translate.currentLang) { diff --git a/src/app/features/administration/form/steps/step-three/step-three.component.html b/src/app/features/administration/form/steps/step-three/step-three.component.html index 96e390f5..317527a2 100644 --- a/src/app/features/administration/form/steps/step-three/step-three.component.html +++ b/src/app/features/administration/form/steps/step-three/step-three.component.html @@ -74,12 +74,17 @@ selectionMode="multiple" inputId="multiple" showButtonBar="true" + [locale]="'calendar_widget' | translate" [inline]="true" [showWeek]="true" > +
+ +
{{ pollService.calendar | json }}
+
{{ 'calendar_widget' | translate }}
diff --git a/src/assets/i18n/FR.json b/src/assets/i18n/FR.json index 70e1096c..385eef74 100644 --- a/src/assets/i18n/FR.json +++ b/src/assets/i18n/FR.json @@ -144,7 +144,7 @@ "selectors": { "lang": "Sélectionner la langue" }, - "validation" : { + "validation": { "You must enter a value": "You must enter a EEEE" }, "You must enter a value": "You must enter a valueeeeeeee", @@ -576,8 +576,7 @@ "the-administrator-locked-this-poll-votes-and-comments-are-frozen-it-is-no-longer-possible-to-partici": "L'administrateur·rice a verrouillé ce sondage. Les votes et commentaires sont gelés, il n'est plus possible de participer", "the-poll-has-expired-it-will-soon-be-deleted": "Le sondage a expiré, il sera bientôt supprimé.", "your-vote-has-been-saved-but-please-note-you-need-to-keep-this-personalised-link-to-be-able-to-edit-": "Votre vote a bien été pris en compte, mais faites attention : ce sondage n'autorise l'édition de votre vote qu'avec le lien personnalisé suivant ; conservez-le précieusement !" - } -, + }, "LANGUAGES": { "DE": "Allemand", "FR": "Français", @@ -593,39 +592,89 @@ "OC": "oc", "SV": "sv" }, - "calendar_widget" : { - "startsWith": "Starts with", - "contains": "Contains", - "notContains": "Not contains", - "endsWith": "Ends with", - "equals": "Equals", - "notEquals": "Not equals", - "noFilter": "No Filter", - "lt": "Less than", - "lte": "Less than or equal to", - "gt": "Greater than", - "gte": "Great then or equals", - "is": "Is", - "isNot": "Is not", - "before": "Before", - "after": "After", - "clear": "Clear", - "apply": "Apply", - "matchAll": "Match All", - "matchAny": "Match Any", - "addRule": "Add Rule", - "removeRule": "Remove Rule", - "accept": "Yes", - "reject": "No", - "choose": "Choose", - "upload": "Upload", - "cancel": "Cancel", - "dayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], - "dayNamesShort": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - "dayNamesMin": ["Su","Mo","Tu","We","Th","Fr","Sa"], - "monthNames": ["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"], - "monthNamesShort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - "today": "Aujourd'hui", - "weekHeader": "Wk" -} + "calendar_widget": { + "startsWith": "Starts with", + "contains": "Contains", + "notContains": "Not contains", + "endsWith": "Ends with", + "equals": "Equals", + "notEquals": "Not equals", + "noFilter": "No Filter", + "lt": "Less than", + "lte": "Less than or equal to", + "gt": "Greater than", + "gte": "Great then or equals", + "is": "Is", + "isNot": "Is not", + "before": "Before", + "after": "After", + "clear": "Clear", + "apply": "Apply", + "matchAll": "Match All", + "matchAny": "Match Any", + "addRule": "Add Rule", + "removeRule": "Remove Rule", + "accept": "Yes", + "reject": "No", + "choose": "Choose", + "upload": "Upload", + "cancel": "Cancel", + "dayNames": [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + "dayNamesShort": [ + "Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat" + ], + "dayNamesMin": [ + "Su", + "Mo", + "Tu", + "We", + "Th", + "Fr", + "Sa" + ], + "monthNames": [ + "Janvier", + "Février", + "Mars", + "Avril", + "Mai", + "Juin", + "Juillet", + "Août", + "Septembre", + "Octobre", + "Novembre", + "Décembre" + ], + "monthNamesShort": [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + "today": "Aujourd'hui", + "weekHeader": "Wk" + } } diff --git a/src/styles/partials/_forms.scss b/src/styles/partials/_forms.scss index 48f18b5e..db1b021a 100644 --- a/src/styles/partials/_forms.scss +++ b/src/styles/partials/_forms.scss @@ -241,6 +241,12 @@ mat-checkbox { border: solix 1px $logo_color; margin: 1em auto; + .pi-chevron-left:after { + content: '<'; + } + .pi-chevron-right:after { + content: '>'; + } .p-datepicker-month { margin-right: 1em; }