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

Port to new i18next wrapper

parent 7b6a91e0
No related branches found
No related tags found
No related merge requests found
......@@ -26,8 +26,6 @@
"vpu-common": "file:./vendor/common"
},
"dependencies": {
"@webcomponents/webcomponentsjs": "^2.2.10",
"i18next": "^17.0.3",
"lit-element": "^2.1.0",
"lit-html": "^1.1.1"
},
......
import path from 'path';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
......@@ -19,7 +20,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
auth @ a8404273
Subproject commit 2752cf0ce9d1710792cc939f8b26f48641693516
Subproject commit a84042737467c0649c083746aa35b43613fdf64a
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