jellyfin-expo/i18n.js

64 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-07-13 16:30:38 +00:00
import * as Localization from 'expo-localization';
import i18next from 'i18next';
2020-07-27 20:51:55 +00:00
import { I18nManager } from 'react-native';
2020-07-13 16:30:38 +00:00
import { initReactI18next } from 'react-i18next';
import en from './langs/en.json';
2020-07-20 05:38:02 +00:00
import ar from './langs/ar.json';
import cs from './langs/cs.json';
import da from './langs/da.json';
2020-07-17 15:44:52 +00:00
import de from './langs/de.json';
2020-07-15 03:57:03 +00:00
import es from './langs/es.json';
2020-07-20 05:38:02 +00:00
import es_AR from './langs/es_AR.json';
2020-07-15 03:57:03 +00:00
import fr from './langs/fr.json';
2020-07-20 05:38:02 +00:00
import it from './langs/it.json';
2020-07-27 15:44:00 +00:00
import ko from './langs/ko.json';
2020-07-20 05:38:02 +00:00
import nb_NO from './langs/nb_NO.json';
2020-07-29 14:51:27 +00:00
import nl from './langs/nl.json';
2020-07-27 15:44:00 +00:00
import pl from './langs/pl.json';
import pt_BR from './langs/pt_BR.json';
import ro from './langs/ro.json';
2020-07-20 05:38:02 +00:00
import sk from './langs/sk.json';
import sl from './langs/sl.json';
import sv from './langs/sv.json';
import zh_Hans from './langs/zh_Hans.json';
import zh_Hant from './langs/zh_Hant.json';
2020-07-13 16:30:38 +00:00
const resources = {
2020-07-22 03:37:43 +00:00
en: { translation: en },
ar: { translation: ar },
cs: { translation: cs },
da: { translation: da },
de: { translation: de },
es: { translation: es },
'es-AR': { translation: es_AR },
fr: { translation: fr },
it: { translation: it },
2020-07-27 15:44:00 +00:00
ko: { translation: ko },
2020-07-22 03:37:43 +00:00
'nb-NO': { translation: nb_NO },
2020-07-29 14:51:27 +00:00
nl: { translation: nl },
2020-07-27 15:44:00 +00:00
pl: { translation: pl },
'pt-BR': { translation: pt_BR },
ro: { translation: ro },
2020-07-22 03:37:43 +00:00
sk: { translation: sk },
sl: { translation: sl },
sv: { translation: sv },
'zh-Hans': { translation: zh_Hans },
'zh-Hant': { translation: zh_Hant }
2020-07-13 16:30:38 +00:00
};
2020-07-27 20:51:55 +00:00
// Ensure RTL layout is enabled for RTL locales
I18nManager.forceRTL(Localization.isRTL);
2020-07-13 16:30:38 +00:00
i18next
2020-07-22 03:37:43 +00:00
.use(initReactI18next)
.init({
// debug: true,
fallbackLng: 'en',
lng: Localization.locale,
interpolation: {
escapeValue: false
},
resources
});