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 <livio.a@gmail.com>
Co-authored-by: Elio Bischof <eliobischof@gmail.com>
Co-authored-by: Max Peintner <max@caos.ch>
Co-authored-by: Elio Bischof <elio@zitadel.com>
This commit is contained in:
dian mushkov
2023-06-16 18:35:03 +03:00
committed by GitHub
parent 7b69449207
commit 4378eb7cb5
31 changed files with 3992 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
import { CommonModule, registerLocaleData } from '@angular/common';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import localeBg from '@angular/common/locales/bg';
import localeDe from '@angular/common/locales/de';
import localeEn from '@angular/common/locales/en';
import localeEs from '@angular/common/locales/es';
@@ -80,6 +81,8 @@ registerLocaleData(localePl);
i18nIsoCountries.registerLocale(require('i18n-iso-countries/langs/pl.json'));
registerLocaleData(localeZh);
i18nIsoCountries.registerLocale(require('i18n-iso-countries/langs/zh.json'));
registerLocaleData(localeBg);
i18nIsoCountries.registerLocale(require('i18n-iso-countries/langs/bg.json'));
export class WebpackTranslateLoader implements TranslateLoader {
getTranslation(lang: string): Observable<any> {

View File

@@ -19,6 +19,7 @@ import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { supportedLanguages } from 'src/app/utils/language';
import { InfoSectionType } from '../../info-section/info-section.component';
import { WarnDialogComponent } from '../../warn-dialog/warn-dialog.component';
import { PolicyComponentServiceType } from '../policy-component-types.enum';
@@ -109,7 +110,7 @@ export class LoginTextsComponent implements OnInit, OnDestroy {
@Input() public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
public KeyNamesArray: string[] = KeyNamesArray;
public LOCALES: string[] = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh'];
public LOCALES: string[] = supportedLanguages;
private sub: Subscription = new Subscription();

View File

@@ -47,6 +47,7 @@ import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { supportedLanguages } from 'src/app/utils/language';
import { InfoSectionType } from '../../info-section/info-section.component';
import { WarnDialogComponent } from '../../warn-dialog/warn-dialog.component';
import { PolicyComponentServiceType } from '../policy-component-types.enum';
@@ -441,7 +442,7 @@ export class MessageTextsComponent implements OnInit, OnDestroy {
};
public locale: string = 'en';
public LOCALES: string[] = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh'];
public LOCALES: string[] = supportedLanguages;
private sub: Subscription = new Subscription();
public canWrite$: Observable<boolean> = this.authService.isAllowed([
this.serviceType === PolicyComponentServiceType.ADMIN

View File

@@ -20,6 +20,7 @@ import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { supportedLanguages } from 'src/app/utils/language';
@Component({
selector: 'cnsl-org-create',
@@ -45,7 +46,7 @@ export class OrgCreateComponent {
public pwdForm?: UntypedFormGroup;
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
public languages: string[] = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh'];
public languages: string[] = supportedLanguages;
public policy?: PasswordComplexityPolicy.AsObject;
public usePassword: boolean = false;

View File

@@ -13,6 +13,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { CountryCallingCodesService, CountryPhoneCode } from 'src/app/services/country-calling-codes.service';
import { formatPhone } from 'src/app/utils/formatPhone';
import { supportedLanguages } from 'src/app/utils/language';
import {
containsLowerCaseValidator,
containsNumberValidator,
@@ -33,7 +34,7 @@ import {
export class UserCreateComponent implements OnInit, OnDestroy {
public user: AddHumanUserRequest.AsObject = new AddHumanUserRequest().toObject();
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
public languages: string[] = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh'];
public languages: string[] = supportedLanguages;
public selected: CountryPhoneCode | undefined;
public countryPhoneCodes: CountryPhoneCode[] = [];
public userForm!: UntypedFormGroup;

View File

@@ -23,6 +23,7 @@ import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { formatPhone } from 'src/app/utils/formatPhone';
import { supportedLanguages } from 'src/app/utils/language';
import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.component';
@Component({
@@ -33,7 +34,7 @@ import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.c
export class AuthUserDetailComponent implements OnDestroy {
public user?: User.AsObject;
public genders: Gender[] = [Gender.GENDER_MALE, Gender.GENDER_FEMALE, Gender.GENDER_DIVERSE];
public languages: string[] = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh'];
public languages: string[] = supportedLanguages;
private subscription: Subscription = new Subscription();

View File

@@ -22,6 +22,7 @@ import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { formatPhone } from 'src/app/utils/formatPhone';
import { supportedLanguages } from 'src/app/utils/language';
import { EditDialogComponent, EditDialogType } from '../auth-user-detail/edit-dialog/edit-dialog.component';
import { ResendEmailDialogComponent } from '../auth-user-detail/resend-email-dialog/resend-email-dialog.component';
import { MachineSecretDialogComponent } from './machine-secret-dialog/machine-secret-dialog.component';
@@ -44,7 +45,7 @@ export class UserDetailComponent implements OnInit {
public user!: User.AsObject;
public metadata: Metadata.AsObject[] = [];
public genders: Gender[] = [Gender.GENDER_MALE, Gender.GENDER_FEMALE, Gender.GENDER_DIVERSE];
public languages: string[] = ['de', 'en', 'es', 'it', 'fr', 'ja', 'pl', 'zh'];
public languages: string[] = supportedLanguages;
public ChangeType: any = ChangeType;

View File

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

View File

@@ -1,3 +1,3 @@
export const supportedLanguages = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh'];
export const supportedLanguagesRegexp: RegExp = /de|en|es|fr|it|ja|pl|zh/;
export const supportedLanguages = ['de', 'en', 'es', 'fr', 'it', 'ja', 'pl', 'zh', 'bg'];
export const supportedLanguagesRegexp: RegExp = /de|en|es|fr|it|ja|pl|zh|bg/;
export const fallbackLanguage: string = 'en';

File diff suppressed because it is too large Load Diff

View File

@@ -1039,7 +1039,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "SMTP Einstellungen",
@@ -1238,7 +1239,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "Email Verification erfolgreich",
@@ -2106,7 +2108,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "Manager hinzufügen",

View File

@@ -1040,7 +1040,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "SMTP Settings",
@@ -1239,7 +1240,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "Email verification done",
@@ -2103,7 +2105,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "Add a Manager",

View File

@@ -1040,7 +1040,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "Ajustes SMTP",
@@ -1239,7 +1240,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "Verificación de email realizada",
@@ -2103,7 +2105,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "Añadir un Mánager",

View File

@@ -1039,7 +1039,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "Paramètres SMTP",
@@ -1238,7 +1239,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "Vérification de l'email effectuée",
@@ -2095,7 +2097,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "Ajouter un manager",

View File

@@ -1039,7 +1039,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "Impostazioni SMTP",
@@ -1238,7 +1239,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "Verifica dell'e-mail terminata con successo.",
@@ -2107,7 +2109,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "Aggiungi un manager",

View File

@@ -1040,7 +1040,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "SMTP設定",
@@ -1234,7 +1235,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "メール認証が完了しました",
@@ -2098,7 +2100,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "マネージャーを追加する",

View File

@@ -1039,7 +1039,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "Ustawienia SMTP",
@@ -1238,7 +1239,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "Weryfikacja adresu e-mail zakończona",
@@ -2107,7 +2109,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "Dodaj managera",

View File

@@ -1039,7 +1039,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"SMTP": {
"TITLE": "SMTP 设置",
@@ -1237,7 +1238,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"KEYS": {
"emailVerificationDoneText": "电子邮件验证完成",
@@ -2094,7 +2096,8 @@
"it": "Italiano",
"ja": "日本語",
"pl": "Polski",
"zh": "简体中文"
"zh": "简体中文",
"bg": "Български"
},
"MEMBER": {
"ADD": "添加管理者",