Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function i18nLoader (
locales: { [namespace: string]: RawLocales },
defaultNS: string,
cb?: i18n.Callback
): i18n.i18n {
const namespaces = Object.keys(locales)
const instance = i18n
.init({
lng: browser.i18n.getUILanguage(),
fallbackLng: 'en',
debug: process.env.NODE_ENV === 'development',
saveMissing: false,
load: 'currentOnly',
defaultNS: defaultNS || namespaces[0] || 'translation',
whitelist: ['en', 'zh-CN', 'zh-TW'],
interpolation: {
escapeValue: false, // not needed for react!!
},
resources: namespaces.reduce((res, ns) => {
wf.auth = wf.dbApp.auth()
wf.authService = firebase.auth.EmailAuthProvider.credential
}
wf.b64EncodeUnicode = b64EncodeUnicode
wf.b64DecodeUnicode = b64DecodeUnicode
_Vue.prototype.$_wf = wf
// Dynamically update `pageTitle` & `pageURL`
_Vue.prototype.$_updateWildfirePageInfo = function ({ pageTitle, pageURL }) {
if (pageTitle) { this.$_wf.config.pageTitle = pageTitle }
if (pageURL) { this.$_wf.config.pageURL = b64EncodeUnicode(pageURL) }
}
i18next.init({
lng: locale,
fallbackLng: 'en',
debug: true,
resources: {
en: {
translation: langEn
},
'zh-CN': {
translation: langZhCN
},
'zh-TW': {
translation: langZhTW
}
}
}, (err, t) => {
if (err) {
module.exports = function(app) {
i18n.init(i18nOptions, function(err) {
if (err)
console.warn('error initializing i18n module');
else
console.log('i18n module initialized');
});
app.use(i18n.handle);
i18n.registerAppHelper(app);
};
init(lang) {
i18next.init(
{
lng: lang,
debug: true,
resources: {
en: {
translation: translations.translation,
},
},
},
err => {
if (err) {
console.error(err);
}
}
);
}
import i18next from "i18next";
const namespace = "d3plus";
import enUS from "./locales/en-US/d3plus.json";
import esES from "./locales/es-ES/d3plus.json";
export default i18next.init({
fallbackLng: "en-US",
defaultNS: namespace,
fallbackNS: namespace,
initImmediate: false,
ns: namespace,
resources: {
"en-US": {[namespace]: enUS},
"es-ES": {[namespace]: esES}
}
});
import translations from '@/setup/translations.json';
import * as VueDeepSet from 'vue-deepset';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-vue/dist/bootstrap-vue.css';
import '@fortawesome/fontawesome-free/css/all.min.css';
Vue.use(BootstrapVue);
Vue.use(VueDeepSet);
Vue.config.productionTip = false;
Vue.use(VueI18Next);
i18next.init({
lng: 'en',
resources: { en: { translation: translations } },
});
const i18n = new VueI18Next(i18next);
new Vue({
render: h => h(ModelerApp),
i18n,
}).$mount('#modeler-app');
function setupI18next(fallbackLng, i18nextOptions) {
i18next.init({
debug: false,
defaultNS: 'messages',
fallbackLng,
react: {
useSuspense: false,
},
...i18nextOptions,
});
return i18next;
}
export function createWithResources(resources) {
i18n.init({
...commonConfig,
...resources,
})
return addPluralRule(i18n)
}
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import XHR from "i18next-xhr-backend";
i18n.use(XHR);
i18n.use(LanguageDetector);
i18n.init({
defaultNS: "dashboard",
fallbackLng: "en",
interpolation: {
escapeValue: false
},
keySeparator: false,
ns: ["dashboard"],
nsSeparator: false
});
export default i18n;