From ca674dc5114790d8d85d2d61250813882ff9b8a3 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Thu, 8 Aug 2019 14:25:46 +0200 Subject: [PATCH] Port to new i18next wrapper --- packages/auth/package.json | 1 - packages/auth/src/i18n.js | 27 ++------------------------- packages/auth/vendor/common | 2 +- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/packages/auth/package.json b/packages/auth/package.json index 700875fb..06361d60 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -25,7 +25,6 @@ "vpu-common": "file:./vendor/common" }, "dependencies": { - "i18next": "^17.0.3", "lit-element": "^2.1.0" }, "scripts": { diff --git a/packages/auth/src/i18n.js b/packages/auth/src/i18n.js index a2380632..02c88eb4 100644 --- a/packages/auth/src/i18n.js +++ b/packages/auth/src/i18n.js @@ -1,29 +1,6 @@ -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 diff --git a/packages/auth/vendor/common b/packages/auth/vendor/common index b30eaa64..378256b0 160000 --- a/packages/auth/vendor/common +++ b/packages/auth/vendor/common @@ -1 +1 @@ -Subproject commit b30eaa6475ccc65b5f99d2ead86ddbe2b8e015a7 +Subproject commit 378256b0ae92712fd5b8feed3a987cd014617c0b -- GitLab