diff options
Diffstat (limited to 'shared/models/i18n/i18n.ts')
-rw-r--r-- | shared/models/i18n/i18n.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts index be1420150..e0e5982f9 100644 --- a/shared/models/i18n/i18n.ts +++ b/shared/models/i18n/i18n.ts | |||
@@ -2,11 +2,12 @@ export const LOCALE_FILES = [ 'player', 'server' ] | |||
2 | 2 | ||
3 | export const I18N_LOCALES = { | 3 | export const I18N_LOCALES = { |
4 | 'en-US': 'English (US)', | 4 | 'en-US': 'English (US)', |
5 | fr: 'French' | 5 | 'fr-FR': 'French (France)' |
6 | } | 6 | } |
7 | 7 | ||
8 | const I18N_LOCALE_ALIAS = { | 8 | const I18N_LOCALE_ALIAS = { |
9 | 'en': 'en-US' | 9 | 'en': 'en-US', |
10 | 'fr': 'fr-FR' | ||
10 | } | 11 | } |
11 | 12 | ||
12 | export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) | 13 | export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) |
@@ -38,6 +39,12 @@ export function getCompleteLocale (locale: string) { | |||
38 | return locale | 39 | return locale |
39 | } | 40 | } |
40 | 41 | ||
42 | export function getShortLocale (locale: string) { | ||
43 | if (locale.indexOf('-') === -1) return locale | ||
44 | |||
45 | return locale.split('-')[0] | ||
46 | } | ||
47 | |||
41 | export function buildFileLocale (locale: string) { | 48 | export function buildFileLocale (locale: string) { |
42 | const completeLocale = getCompleteLocale(locale) | 49 | const completeLocale = getCompleteLocale(locale) |
43 | 50 | ||