translate calendar elements from app init

This commit is contained in:
Tykayn 2021-11-08 10:26:16 +01:00 committed by tykayn
parent c67f309180
commit a438bdff6c
5 changed files with 109 additions and 38 deletions

View File

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

View File

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

View File

@ -74,12 +74,17 @@
selectionMode="multiple"
inputId="multiple"
showButtonBar="true"
[locale]="'calendar_widget' | translate"
[inline]="true"
[showWeek]="true"
></p-calendar>
</div>
<div class="day-time">
<app-time-list></app-time-list>
</div>
<div class="debug">
<pre>{{ pollService.calendar | json }}</pre>
<pre>{{ 'calendar_widget' | translate }}</pre>
</div>
</div>
</div>

View File

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

View File

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