]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/models/i18n/i18n.ts
Log error on unknown hook
[github/Chocobozzz/PeerTube.git] / shared / models / i18n / i18n.ts
index 0c79c431eafa7b3feb0ca438448473783bbbc618..5d1d3f2ab6c2e21f44e446d40f17f1a13fa96208 100644 (file)
@@ -3,17 +3,39 @@ export const LOCALE_FILES = [ 'player', 'server' ]
 export const I18N_LOCALES = {
   'en-US': 'English',
   'fr-FR': 'Français',
-  'eu-ES': 'euskara',
-  'ca-ES': 'català'
-  // 'pl-PL': 'polski'
+  'ja-JP': '日本語',
+  'eu-ES': 'Euskara',
+  'ca-ES': 'Català',
+  'cs-CZ': 'Čeština',
+  'eo': 'Esperanto',
+  'de-DE': 'Deutsch',
+  'it-IT': 'Italiano',
+  'nl-NL': 'Nederlands',
+  'es-ES': 'Español',
+  'oc': 'Occitan',
+  'zh-Hant-TW': '繁體中文(台灣)',
+  'pt-BR': 'Português (Brasil)',
+  'pt-PT': 'Português (Portugal)',
+  'sv-SE': 'svenska',
+  'pl-PL': 'Polski',
+  'ru-RU': 'русский',
+  'zh-Hans-CN': '简体中文(中国)'
 }
 
 const I18N_LOCALE_ALIAS = {
   'en': 'en-US',
   'fr': 'fr-FR',
   'eu': 'eu-ES',
-  'ca': 'ca-ES'
-  // 'pl': 'pl-PL'
+  'ca': 'ca-ES',
+  'cs': 'cs-CZ',
+  'de': 'de-DE',
+  'es': 'es-ES',
+  'pt': 'pt-PT',
+  'sv': 'sv-SE',
+  'pl': 'pl-PL',
+  'ru': 'ru-RU',
+  'nl': 'nl-NL',
+  'zh': 'zh-Hans-CN'
 }
 
 export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES)
@@ -27,6 +49,10 @@ export function isDefaultLocale (locale: string) {
   return getCompleteLocale(locale) === getCompleteLocale(getDefaultLocale())
 }
 
+export function peertubeTranslate (str: string, translations?: { [ id: string ]: string }) {
+  return translations && translations[str] ? translations[str] : str
+}
+
 const possiblePaths = POSSIBLE_LOCALES.map(l => '/' + l)
 export function is18nPath (path: string) {
   return possiblePaths.indexOf(path) !== -1
@@ -53,5 +79,5 @@ export function getShortLocale (locale: string) {
 export function buildFileLocale (locale: string) {
   const completeLocale = getCompleteLocale(locale)
 
-  return completeLocale.replace('-', '_')
+  return completeLocale.replace(/-/g, '_')
 }