diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-28 13:59:48 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-28 15:53:12 +0200 |
commit | 8afc19a6121569da054462c7cb351a3f13030a32 (patch) | |
tree | 6dba42963681062536e635dd3ca401e1c7b0ca9f /shared/models | |
parent | 3ea9a1c311c3e3c55fb95560d4dd99a77c52df4a (diff) | |
download | PeerTube-8afc19a6121569da054462c7cb351a3f13030a32.tar.gz PeerTube-8afc19a6121569da054462c7cb351a3f13030a32.tar.zst PeerTube-8afc19a6121569da054462c7cb351a3f13030a32.zip |
Add ability to choose the language
Diffstat (limited to 'shared/models')
-rw-r--r-- | shared/models/i18n/i18n.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts index e2b440900..14b02a01d 100644 --- a/shared/models/i18n/i18n.ts +++ b/shared/models/i18n/i18n.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | export const LOCALE_FILES = [ 'player', 'server' ] | 1 | 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', |
5 | 'fr-FR': 'Français (France)' | 5 | 'fr-FR': 'Français' |
6 | } | 6 | } |
7 | 7 | ||
8 | const I18N_LOCALE_ALIAS = { | 8 | const I18N_LOCALE_ALIAS = { |
@@ -13,8 +13,6 @@ const I18N_LOCALE_ALIAS = { | |||
13 | export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) | 13 | export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) |
14 | .concat(Object.keys(I18N_LOCALE_ALIAS)) | 14 | .concat(Object.keys(I18N_LOCALE_ALIAS)) |
15 | 15 | ||
16 | const possiblePaths = POSSIBLE_LOCALES.map(l => '/' + l) | ||
17 | |||
18 | export function getDefaultLocale () { | 16 | export function getDefaultLocale () { |
19 | return 'en-US' | 17 | return 'en-US' |
20 | } | 18 | } |
@@ -23,6 +21,7 @@ export function isDefaultLocale (locale: string) { | |||
23 | return getCompleteLocale(locale) === getCompleteLocale(getDefaultLocale()) | 21 | return getCompleteLocale(locale) === getCompleteLocale(getDefaultLocale()) |
24 | } | 22 | } |
25 | 23 | ||
24 | const possiblePaths = POSSIBLE_LOCALES.map(l => '/' + l) | ||
26 | export function is18nPath (path: string) { | 25 | export function is18nPath (path: string) { |
27 | return possiblePaths.indexOf(path) !== -1 | 26 | return possiblePaths.indexOf(path) !== -1 |
28 | } | 27 | } |