diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-16 10:48:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-16 10:48:35 +0200 |
commit | 3dfa84940273619ae00f11a5f419a5e4876b2f53 (patch) | |
tree | bd31beeb985a9696af90e15ff6b767c4a0da03d9 /shared/models/i18n | |
parent | 4f1f6f038389ce9cdf0c77dfccdc63efc6948101 (diff) | |
download | PeerTube-3dfa84940273619ae00f11a5f419a5e4876b2f53.tar.gz PeerTube-3dfa84940273619ae00f11a5f419a5e4876b2f53.tar.zst PeerTube-3dfa84940273619ae00f11a5f419a5e4876b2f53.zip |
Translate subtitle langs in player
Diffstat (limited to 'shared/models/i18n')
-rw-r--r-- | shared/models/i18n/i18n.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts index 2530a1927..c5de972ac 100644 --- a/shared/models/i18n/i18n.ts +++ b/shared/models/i18n/i18n.ts | |||
@@ -36,6 +36,10 @@ export function isDefaultLocale (locale: string) { | |||
36 | return getCompleteLocale(locale) === getCompleteLocale(getDefaultLocale()) | 36 | return getCompleteLocale(locale) === getCompleteLocale(getDefaultLocale()) |
37 | } | 37 | } |
38 | 38 | ||
39 | export function peertubeTranslate (str: string, translations?: { [ id: string ]: string }) { | ||
40 | return translations && translations[str] ? translations[str] : str | ||
41 | } | ||
42 | |||
39 | const possiblePaths = POSSIBLE_LOCALES.map(l => '/' + l) | 43 | const possiblePaths = POSSIBLE_LOCALES.map(l => '/' + l) |
40 | export function is18nPath (path: string) { | 44 | export function is18nPath (path: string) { |
41 | return possiblePaths.indexOf(path) !== -1 | 45 | return possiblePaths.indexOf(path) !== -1 |