diff --git a/package-lock.json b/package-lock.json index 9887b15c..752f2702 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "aurelia-i18n", - "version": "3.0.0-beta.2", + "version": "3.0.0-beta.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3360,7 +3360,10 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/full-icu/-/full-icu-1.2.1.tgz", "integrity": "sha512-E2s1b4GVbt8PyG+iaRN6ks8N0Oy2LOJz7SIMUwWWWx7Mr5Z08hKkfpkKQbOtOGqzkFpckDJHjjZ8qfigN2W86A==", - "dev": true + "dev": true, + "requires": { + "icu4c-data": "^0.63.2" + } }, "function-bind": { "version": "1.1.1", @@ -3849,9 +3852,9 @@ } }, "i18next": { - "version": "11.6.0", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-11.6.0.tgz", - "integrity": "sha512-+eOdu1laoPX8l3zuaEFpf0MPYqAyKeX46WEjRkpPLp0TcijP3ww6NrDCPcRwX3yKB69R+ggiLvLGzCm8ALaVXQ==" + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-14.0.1.tgz", + "integrity": "sha512-wsKfQuYsy4RdCaqqN71eDjWMhizhTfQSIBGttEA7vcboQrUfpQlCezrSzrtmoW9F9tmVyNs38iBgLYLMhRSeIQ==" }, "iconv-lite": { "version": "0.4.23", @@ -3862,6 +3865,12 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "icu4c-data": { + "version": "0.63.2", + "resolved": "https://registry.npmjs.org/icu4c-data/-/icu4c-data-0.63.2.tgz", + "integrity": "sha512-vT6/47CcBzDemlhRzkL7dZLoNvuUWjjiuKZHMt5T4dbkKAqLBh7ZQ33GU13ecC/aIcMlIdBOqtF4uIYTgWML4Q==", + "dev": true + }, "import-local": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", diff --git a/package.json b/package.json index fbbe0753..a535a238 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "aurelia-pal": "^1.3.0", "aurelia-templating": "^1.8.2", "aurelia-templating-resources": "^1.7.1", - "i18next": "^11.6.0" + "i18next": "^14.0.1" } }, "dependencies": { @@ -125,7 +125,7 @@ "aurelia-pal": "^1.3.0", "aurelia-templating": "^1.8.2", "aurelia-templating-resources": "^1.7.1", - "i18next": "^11.6.0" + "i18next": "^14.0.1" }, "devDependencies": { "@types/i18next": "^8.4.5", diff --git a/src/i18n.ts b/src/i18n.ts index 62ec8a1a..7d8fb99a 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -39,9 +39,8 @@ export class I18N { } public async setup(options?: AureliaEnhancedOptions & i18next.InitOptions) { - const defaultOptions = { + const defaultOptions: AureliaEnhancedOptions & i18next.InitOptions = { skipTranslationOnMissingKey: false, - compatibilityAPI: "v1", compatibilityJSON: "v1", lng: "en", attributes: ["t", "i18n"], @@ -50,7 +49,7 @@ export class I18N { }; this.i18nextDeferred = new Promise((resolve, reject) => { - this.i18next = this.i18next.init(options || defaultOptions, (err) => { + this.i18next = this.i18next.createInstance(options || defaultOptions, (err) => { if (err) { reject(err); } @@ -71,7 +70,7 @@ export class I18N { return this.i18nextDeferred; } - public setLocale(locale: string): Promise { + public setLocale(locale: string): Promise { return new Promise((resolve, reject) => { const oldLocale = this.getLocale(); this.i18next.changeLanguage(locale, (err, tr) => { @@ -120,7 +119,7 @@ export class I18N { return new this.Intl.DateTimeFormat(locales || this.getLocale(), options); } - public tr(key: string | string[], options?: i18next.TranslationOptions) { + public tr(key: string | string[], options?: i18next.TOptions) { let fullOptions = this.globalVars; if (options !== undefined) { diff --git a/src/t/t-value-converter.ts b/src/t/t-value-converter.ts index c927b406..b0572c02 100644 --- a/src/t/t-value-converter.ts +++ b/src/t/t-value-converter.ts @@ -9,7 +9,7 @@ export class TValueConverter { constructor(private service: I18N) { } - public toView(value: any, options?: i18next.TranslationOptions) { + public toView(value: any, options?: i18next.TOptions) { return this.service.tr(value, options); } }