Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import lang from 'i18n-js';
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import store from './store/configureStore';
import App from './dapp';
import init from './store/init';
import translations from './languages';
import './dapp.css';
// Init i18n translation
lang.defaultLocale = 'en';
lang.locale = navigator.language;
lang.fallbacks = true;
lang.translations = translations;
// Init Redux store
init();
render(
,
document.getElementById('app')
);
const { languageTag, isRTL } =
RNLocalize.findBestAvailableLanguage(Object.keys(translationPaths)) ||
fallback;
const fileContent = await (Platform.OS === "android"
? RNFS.readFileAssets(translationPaths[languageTag], "utf8")
: RNFS.readFile(translationPaths[languageTag], "utf8"));
// clear translation cache
translate.cache.clear();
// update layout direction
I18nManager.forceRTL(isRTL);
// set i18n-js config
i18n.translations = { [languageTag]: JSON.parse(fileContent) };
i18n.locale = languageTag;
};
it('sets the weekDays and format', () => {
const datepickerProps = datepicker.props
expect(datepickerProps.fixedWeeks).toBeTruthy();
expect(datepickerProps.enableOutsideDays).toBeTruthy();
expect(datepickerProps.inline).toBeTruthy();
expect(datepickerProps.locale).toEqual(I18n.locale);
expect(datepickerProps.localeUtils).toEqual(LocaleUtils);
});
});
export const getI18nImage = (filename: string): string => {
const locale = locales.includes(I18n.locale)
? I18n.locale
: I18n.defaultLocale
return localeSpecificImages[locale][filename]
}
PASSWORD_CHANGE: '비밀번호 변경하기',
PASSWORD_CURRENT: '기존 비밀번호',
PASSWORD_NEW: '새로운 비밀번호',
PASSWORD_NEW_REPEAT: '새로운 비밀번호 확인',
NEXT: '다음',
OK: '확인',
CONFIRM: '확인',
LOGIN_INFORMATION: '계정 정보',
SIGNED_IN_WITH_GOOGLE: '구글 계정으로 로그인 됨',
SIGNED_IN_WITH_FACEBOOK: '페이스북 계정으로 로그인 됨',
SIGNED_IN_WITH_EMAIL: '이메일로 로그인 됨',
};
i18n.fallbacks = true;
i18n.translations = { en, ko };
i18n.locale = Localization.locale;
export const getString = (param: string, mapObj?: object): string => {
if (mapObj) {
i18n.t(param, mapObj);
}
return i18n.t(param);
};
afterEach(() => {
I18n.locale = 'en';
});
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;
changeLocale = (locale: string) => {
i18n.locale = locale;
this.setState({ locale });
}
import I18n from 'i18n-js';
import de from './locales/de';
import en from './locales/en';
I18n.fallbacks = true;
I18n.translations = {
en,
de,
};
I18n.locale = navigator.language || navigator.userLanguage;
export default I18n;
afterAll(() => { I18n.locale = 'en'; });