jellyfin-expo/i18n.js

92 lines
2.6 KiB
JavaScript
Raw Normal View History

/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
2020-07-13 16:30:38 +00:00
import * as Localization from 'expo-localization';
import i18next from 'i18next';
import { initReactI18next } from 'react-i18next';
2021-10-07 05:06:01 +00:00
import { I18nManager } from 'react-native';
2020-07-13 16:30:38 +00:00
2020-07-20 05:38:02 +00:00
import ar from './langs/ar.json';
import bg from './langs/bg.json';
2020-07-20 05:38:02 +00:00
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';
2021-10-07 05:06:01 +00:00
import en from './langs/en.json';
2020-07-15 03:57:03 +00:00
import es from './langs/es.json';
import es_419 from './langs/es_419.json';
2020-07-20 05:38:02 +00:00
import es_AR from './langs/es_AR.json';
import fa from './langs/fa.json';
2020-07-15 03:57:03 +00:00
import fr from './langs/fr.json';
2020-08-12 05:20:35 +00:00
import hu from './langs/hu.json';
2020-07-20 05:38:02 +00:00
import it from './langs/it.json';
import ja from './langs/ja.json';
2020-12-16 21:57:22 +00:00
import kk from './langs/kk.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';
import ru from './langs/ru.json';
2020-07-20 05:38:02 +00:00
import sk from './langs/sk.json';
import sl from './langs/sl.json';
2021-04-06 22:02:49 +00:00
import sr from './langs/sr.json';
2020-07-20 05:38:02 +00:00
import sv from './langs/sv.json';
2020-08-18 15:00:16 +00:00
import ta from './langs/ta.json';
2021-04-06 22:02:49 +00:00
import uk from './langs/uk.json';
2020-07-20 05:38:02 +00:00
import zh_Hans from './langs/zh_Hans.json';
import zh_Hant from './langs/zh_Hant.json';
2020-07-13 16:30:38 +00:00
2021-02-23 20:44:41 +00:00
export const resources = {
2020-07-22 03:37:43 +00:00
en: { translation: en },
ar: { translation: ar },
bg: { translation: bg },
2020-07-22 03:37:43 +00:00
cs: { translation: cs },
da: { translation: da },
de: { translation: de },
es: { translation: es },
'es-419': { translation: es_419 },
2020-07-22 03:37:43 +00:00
'es-AR': { translation: es_AR },
fa: { translation: fa },
2020-07-22 03:37:43 +00:00
fr: { translation: fr },
2020-08-12 05:20:35 +00:00
hu: { translation: hu },
2020-07-22 03:37:43 +00:00
it: { translation: it },
ja: { translation: ja },
2020-12-16 21:57:22 +00:00
kk: { translation: kk },
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 },
ru: { translation: ru },
2020-07-22 03:37:43 +00:00
sk: { translation: sk },
sl: { translation: sl },
2021-04-06 22:02:49 +00:00
sr: { translation: sr },
2020-07-22 03:37:43 +00:00
sv: { translation: sv },
2020-08-18 15:00:16 +00:00
ta: { translation: ta },
2021-04-06 22:02:49 +00:00
uk: { translation: uk },
2020-07-22 03:37:43 +00:00
'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
});
2021-02-23 20:44:41 +00:00
// Export i18next instance for use in tests
export default i18next;