Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as RNLocalize from 'react-native-localize';
import I18n from 'i18next';
import en from './en';
import fr from './fr';
const locales = RNLocalize.getLocales();
I18n.init({
debug: true,
useLocalStorage: true,
lng: locales[0].languageCode,
fallbackLng: 'en',
resources: { fr: { translation: fr }, en: { translation: en }, 'fr-FR': { translation: fr } },
});
export default I18n;
render() {
return (
import * as Localization from 'react-native-localize';
import en from './assets/langs/en.json';
import i18n from 'i18n-js';
import ko from './assets/langs/ko.json';
const locales = Localization.getLocales();
if (Array.isArray(locales)) {
i18n.locale = locales[0].languageTag;
}
i18n.fallbacks = true;
i18n.translations = { en, ko };
export const getString = (param: string, mapObj?: object): string => {
if (mapObj) {
i18n.t(param, mapObj);
}
return i18n.t(param);
};
render() {
if (!this.state.isTranslationLoaded) {
return ;
}
return (
import I18n from 'i18n-js';
import * as RNLocalize from 'react-native-localize';
import en from './translations/en';
const locales = RNLocalize.getLocales();
if (Array.isArray(locales)) {
I18n.locale = locales[ 0 ].languageTag;
}
I18n.fallbacks = true;
I18n.translations = {
en,
};
export default I18n;
import I18n from "i18n-js"
import * as RNLocalize from "react-native-localize"
const en = require("./locales/en.json")
const ja = require("./locales/ja.json")
const locales = RNLocalize.getLocales()
if (Array.isArray(locales)) {
I18n.locale = locales[0].languageTag
}
I18n.fallbacks = true
I18n.translations = {
en,
ja,
}
export default I18n
import * as RNLocalize from "react-native-localize";
import i18n from 'i18n-js';
import en from './locales.__generate__/en.json'
import vi from './locales.__generate__/vi.json'
i18n.defaultLocale = 'en';
i18n.locale = RNLocalize.getLocales()[0].languageTag;
i18n.fallbacks = true;
i18n.translations = { en, vi };
export default i18n;
constructor(props) {
super(props)
let countryValue = ''
const locales = RNLocalize.getLocales()
if (locales) {
const countryMatch = countryOptions.find(c => {
if (c.value) {
return (
c.value.code.toLowerCase() === locales[0].countryCode.toLowerCase()
)
}
})
if (countryMatch) {
countryValue = countryMatch.value
}
}
this.state = {
countryValue: countryValue,
phoneValue: '',