]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/translations-manager.ts
Better display redundancy pies
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / translations-manager.ts
index 631e3feba1a2ae614c6b818695cc488f03042e69..8a6e67dda088355a027148f23863861d378605f6 100644 (file)
@@ -3,7 +3,7 @@ import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from
 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<any>
 
-    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 => {