aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/i18n/i18n.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models/i18n/i18n.ts')
-rw-r--r--shared/models/i18n/i18n.ts11
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
3export const I18N_LOCALES = { 3export 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
8const I18N_LOCALE_ALIAS = { 8const I18N_LOCALE_ALIAS = {
9 'en': 'en-US' 9 'en': 'en-US',
10 'fr': 'fr-FR'
10} 11}
11 12
12export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) 13export 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
42export function getShortLocale (locale: string) {
43 if (locale.indexOf('-') === -1) return locale
44
45 return locale.split('-')[0]
46}
47
41export function buildFileLocale (locale: string) { 48export function buildFileLocale (locale: string) {
42 const completeLocale = getCompleteLocale(locale) 49 const completeLocale = getCompleteLocale(locale)
43 50