Skip to content
Snippets Groups Projects
Commit d5736a49 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Port to new i18next wrapper

parent cf355771
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,6 @@
"vpu-common": "file:./vendor/common"
},
"dependencies": {
"i18next": "^17.0.3",
"lit-element": "^2.1.0"
},
"scripts": {
......
import path from 'path';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import copy from 'rollup-plugin-copy';
......@@ -18,7 +19,12 @@ export default {
},
plugins: [
multiEntry(),
resolve(),
resolve({
customResolveOptions: {
// ignore node_modules from vendored packages
moduleDirectory: path.join(process.cwd(), 'node_modules')
}
}),
commonjs({
include: 'node_modules/**'
}),
......
import i18next from 'i18next';
import {createInstance} from 'vpu-common/i18next.js';
import de from './i18n/de/translation.json';
import en from './i18n/en/translation.json';
const i18n = i18next.createInstance();
i18n.init({
lng: 'de',
fallbackLng: ['de'],
debug: false,
initImmediate: false, // Don't init async
resources: {
en: {translation: en},
de: {translation: de}
},
});
console.assert(i18n.isInitialized);
function dateTimeFormat(date, options) {
return new Intl.DateTimeFormat(i18n.languages, options).format(date);
}
function numberFormat(number, options) {
return new Intl.NumberFormat(i18n.languages, options).format(number);
}
export {i18n, dateTimeFormat, numberFormat};
export const i18n = createInstance({en: en, de: de}, 'de', 'en');
\ No newline at end of file
import {html, css, LitElement} from 'lit-element';
import {i18n, dateTimeFormat, numberFormat} from './i18n.js';
import {i18n} from './i18n.js';
import utils from 'vpu-common/utils';
/**
......
common @ 378256b0
Subproject commit b30eaa6475ccc65b5f99d2ead86ddbe2b8e015a7
Subproject commit 378256b0ae92712fd5b8feed3a987cd014617c0b
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment