mirror of https://github.com/abpframework/abp.git
22 changed files with 264 additions and 67 deletions
@ -0,0 +1,33 @@ |
|||||
|
// Different locales from .NET
|
||||
|
// Key is .NET locale, value is Angular locale
|
||||
|
|
||||
|
export default { |
||||
|
'ar-sa': 'ar-SA', |
||||
|
'ca-ES-valencia': 'ca-ES-VALENCIA', |
||||
|
'de-de': 'de', |
||||
|
'es-ES': 'es', |
||||
|
'en-US': 'en', |
||||
|
'fil-Latn': 'en', |
||||
|
'ku-Arab': 'en', |
||||
|
'ky-Cyrl': 'en', |
||||
|
'mi-Latn': 'en', |
||||
|
'prs-Arab': 'en', |
||||
|
'qut-Latn': 'en', |
||||
|
nso: 'en', |
||||
|
quz: 'en', |
||||
|
'fr-FR': 'fr', |
||||
|
'gd-Latn': 'gd', |
||||
|
'ha-Latn': 'ha', |
||||
|
'ig-Latn': 'ig', |
||||
|
'it-it': 'it', |
||||
|
'mn-Cyrl': 'mn', |
||||
|
'pt-BR': 'pt', |
||||
|
'sd-Arab': 'pa-Arab', |
||||
|
'sr-Cyrl-RS': 'sr-Cyrl', |
||||
|
'sr-Latn-RS': 'sr-Latn', |
||||
|
'tg-Cyrl': 'tg', |
||||
|
'tk-Latn': 'tk', |
||||
|
'tt-Cyrl': 'tt', |
||||
|
'ug-Arab': 'ug', |
||||
|
'yo-Latn': 'yo', |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
export * from './different-locales'; |
||||
@ -0,0 +1 @@ |
|||||
|
export * from './locale.provider'; |
||||
@ -0,0 +1,24 @@ |
|||||
|
import { LOCALE_ID, Provider } from '@angular/core'; |
||||
|
import localesMapping from '../constants/different-locales'; |
||||
|
import { LocalizationService } from '../services/localization.service'; |
||||
|
|
||||
|
export class LocaleId extends String { |
||||
|
constructor(private localizationService: LocalizationService) { |
||||
|
super(); |
||||
|
} |
||||
|
|
||||
|
toString(): string { |
||||
|
const { currentLang } = this.localizationService; |
||||
|
return localesMapping[currentLang] || currentLang; |
||||
|
} |
||||
|
|
||||
|
valueOf(): string { |
||||
|
return this.toString(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export const LocaleProvider: Provider = { |
||||
|
provide: LOCALE_ID, |
||||
|
useClass: LocaleId, |
||||
|
deps: [LocalizationService], |
||||
|
}; |
||||
Loading…
Reference in new issue