There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat: init languageDetector
JimmFlyd0da2a16c310
diff --git a/packages/i18n/package.json b/packages/i18n/package.jsonindex cc559528e3..d4754700fb 100644--- a/packages/i18n/package.json+++ b/packages/i18n/package.json@@ -19,6 +19,7 @@},"dependencies": {"i18next": "^21.9.1",+ "i18next-browser-languagedetector": "^7.0.1","prettier": "^2.7.1","react-i18next": "^11.18.4"},diff --git a/packages/i18n/src/index.ts b/packages/i18n/src/index.tsindex cef066bb29..4095c417ad 100644--- a/packages/i18n/src/index.ts+++ b/packages/i18n/src/index.ts@@ -1,5 +1,6 @@import i18next, { Resource } from 'i18next';import { Trans, initReactI18next, useTranslation } from 'react-i18next';+import detector from 'i18next-browser-languagedetector';import { LOCALES } from './resources/index.js';import type en_US from './resources/en.json';@@ -45,15 +46,18 @@ const language = standardizeLocale();const i18n = i18next.createInstance();-i18n.use(initReactI18next).init({- lng: language,- fallbackLng,- debug: false,- resources,- interpolation: {- escapeValue: false, // not needed for react as it escapes by default- },-});+i18n+ .use(detector)+ .use(initReactI18next)+ .init({+ lng: language,+ fallbackLng,+ debug: false,+ resources,+ interpolation: {+ escapeValue: false, // not needed for react as it escapes by default+ },+ });i18n.on('languageChanged', () => {// localStorage.setItem(STORAGE_KEY, lng);diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 76ec8caa50..f37413be2d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -162,11 +162,13 @@ importers:specifiers:'@types/prettier': ^2.7.2i18next: ^21.9.1+ i18next-browser-languagedetector: ^7.0.1prettier: ^2.7.1react-i18next: ^11.18.4typescript: ^4.8.4dependencies:i18next: 21.10.0+ i18next-browser-languagedetector: 7.0.1prettier: 2.7.1react-i18next: [email protected]devDependencies:@@ -5610,6 +5612,12 @@ packages:hasBin: truedev: true+ /i18next-browser-languagedetector/7.0.1:+ resolution: {integrity: sha512-Pa5kFwaczXJAeHE56CHG2aWzFBMJNUNghf0Pm4SwSrEMps/PTKqW90EYWlIvhuYStf3Sn1K0vw+gH3+TLdkH1g==}+ dependencies:+ '@babel/runtime': 7.20.7+ dev: false+/i18next/21.10.0:resolution: {integrity: sha512-YeuIBmFsGjUfO3qBmMOc0rQaun4mIpGKET5WDwvu8lU7gvwpcariZLNtL0Fzj+zazcHUrlXHiptcFhBMFaxzfg==}dependencies: