feat: internationalization Bulgarian (#5998)

* Feature BG init

* lint fix

* Fix merge conflict

* merge main branch add bg lang

* reference centrally defined langs

* refactor supportedLanguages

---------

Co-authored-by: Livio Spring <[email protected]>
Co-authored-by: Elio Bischof <[email protected]>
Co-authored-by: Max Peintner <[email protected]>
Co-authored-by: Elio Bischof <[email protected]>
This commit is contained in:
dian mushkov
2023-06-16 17:35:03 +02:00
committed by GitHub
co-authored by Livio Spring Elio Bischof Max Peintner Elio Bischof
parent 7b69449207
commit 4378eb7cb5
31 changed files with 3992 additions and 36 deletions
@@ -2,6 +2,7 @@ import { DatePipe } from '@angular/common';
import { Pipe, PipeTransform } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import * as moment from 'moment';
import { supportedLanguages } from 'src/app/utils/language';
@Pipe({
name: 'localizedDate',
@@ -22,9 +23,7 @@ export class LocalizedDatePipe implements PipeTransform {
return moment(value).format(`${format}, HH:mm`);
}
} else {
const lang = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh'].includes(this.translateService.currentLang)
? this.translateService.currentLang
: 'en';
const lang = supportedLanguages.includes(this.translateService.currentLang) ? this.translateService.currentLang : 'en';
const datePipe: DatePipe = new DatePipe(lang);
return datePipe.transform(value, pattern ?? 'mediumDate');
}