X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fassets%2Fplayer%2Ftranslations-manager.ts;h=8a6e67dda088355a027148f23863861d378605f6;hb=51d811751f1a299c61d64e11fbe600edeb6d586d;hp=e9f300ce71ac59649036b3edab23929e3ccef076;hpb=3f9c4955af81702591a6eeb2069f99faf0d2814d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/assets/player/translations-manager.ts b/client/src/assets/player/translations-manager.ts index e9f300ce7..8a6e67dda 100644 --- a/client/src/assets/player/translations-manager.ts +++ b/client/src/assets/player/translations-manager.ts @@ -1,9 +1,9 @@ -import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models' +import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '@shared/core-utils/i18n' export class TranslationsManager { private static videojsLocaleCache: { [ path: string ]: any } = {} - static getServerTranslations (serverUrl: string, locale: string) { + static getServerTranslations (serverUrl: string, locale: string): Promise<{ [id: string]: string }> { const path = TranslationsManager.getLocalePath(serverUrl, locale) // It is the default locale, nothing to translate if (!path) return Promise.resolve(undefined) @@ -23,13 +23,13 @@ export class TranslationsManager { let p: Promise - if (TranslationsManager.videojsLocaleCache[ path ]) { - p = Promise.resolve(TranslationsManager.videojsLocaleCache[ path ]) + if (TranslationsManager.videojsLocaleCache[path]) { + p = Promise.resolve(TranslationsManager.videojsLocaleCache[path]) } else { p = fetch(path + '/player.json') .then(res => res.json()) .then(json => { - TranslationsManager.videojsLocaleCache[ path ] = json + TranslationsManager.videojsLocaleCache[path] = json return json }) .catch(err => {