diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-06 17:37:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-06 17:37:13 +0200 |
commit | 74b7c6d48e9ca377fe938c8134ed74b612e62ba0 (patch) | |
tree | cb848dec054a71669fef5ea3986bdd0d2c354248 /client/src/assets/player | |
parent | 7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac (diff) | |
download | PeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.tar.gz PeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.tar.zst PeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.zip |
Little i18n refractoring
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/peertube-player.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts index b604097fa..9e37b75d2 100644 --- a/client/src/assets/player/peertube-player.ts +++ b/client/src/assets/player/peertube-player.ts | |||
@@ -12,7 +12,7 @@ import './peertube-videojs-plugin' | |||
12 | import './peertube-load-progress-bar' | 12 | import './peertube-load-progress-bar' |
13 | import { videojsUntyped } from './peertube-videojs-typings' | 13 | import { videojsUntyped } from './peertube-videojs-typings' |
14 | import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils' | 14 | import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils' |
15 | import { is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n' | 15 | import { getCompleteLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n' |
16 | 16 | ||
17 | // Change 'Playback Rate' to 'Speed' (smaller for our settings menu) | 17 | // Change 'Playback Rate' to 'Speed' (smaller for our settings menu) |
18 | videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' | 18 | videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' |
@@ -141,11 +141,13 @@ function addContextMenu (player: any, videoEmbedUrl: string) { | |||
141 | } | 141 | } |
142 | 142 | ||
143 | function loadLocale (serverUrl: string, videojs: any, locale: string) { | 143 | function loadLocale (serverUrl: string, videojs: any, locale: string) { |
144 | if (!is18nLocale(locale) || isDefaultLocale(locale)) return undefined | 144 | const completeLocale = getCompleteLocale(locale) |
145 | 145 | ||
146 | return fetch(serverUrl + '/client/locales/' + locale + '/player.json') | 146 | if (!is18nLocale(completeLocale) || isDefaultLocale(completeLocale)) return Promise.resolve(undefined) |
147 | |||
148 | return fetch(serverUrl + '/client/locales/' + completeLocale + '/player.json') | ||
147 | .then(res => res.json()) | 149 | .then(res => res.json()) |
148 | .then(json => videojs.addLanguage(locale, json)) | 150 | .then(json => videojs.addLanguage(completeLocale, json)) |
149 | } | 151 | } |
150 | 152 | ||
151 | export { | 153 | export { |