aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-06 17:37:13 +0200
committerChocobozzz <me@florianbigard.com>2018-06-06 17:37:13 +0200
commit74b7c6d48e9ca377fe938c8134ed74b612e62ba0 (patch)
treecb848dec054a71669fef5ea3986bdd0d2c354248 /client/src/assets
parent7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac (diff)
downloadPeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.tar.gz
PeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.tar.zst
PeerTube-74b7c6d48e9ca377fe938c8134ed74b612e62ba0.zip
Little i18n refractoring
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/peertube-player.ts10
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'
12import './peertube-load-progress-bar' 12import './peertube-load-progress-bar'
13import { videojsUntyped } from './peertube-videojs-typings' 13import { videojsUntyped } from './peertube-videojs-typings'
14import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils' 14import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils'
15import { is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n' 15import { 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)
18videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' 18videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
@@ -141,11 +141,13 @@ function addContextMenu (player: any, videoEmbedUrl: string) {
141} 141}
142 142
143function loadLocale (serverUrl: string, videojs: any, locale: string) { 143function 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
151export { 153export {