Replace deprecated i18next-parser with i18next-cli
This commit is contained in:
@@ -1,32 +0,0 @@
|
|||||||
import type { UserConfig } from "i18next-parser";
|
|
||||||
|
|
||||||
const config: UserConfig = {
|
|
||||||
keySeparator: ".",
|
|
||||||
namespaceSeparator: false,
|
|
||||||
contextSeparator: "|",
|
|
||||||
pluralSeparator: "_",
|
|
||||||
createOldCatalogs: false,
|
|
||||||
defaultNamespace: "app",
|
|
||||||
lexers: {
|
|
||||||
ts: [
|
|
||||||
{
|
|
||||||
lexer: "JavascriptLexer",
|
|
||||||
functions: ["t", "translatedError"],
|
|
||||||
namespaceFunctions: ["useTranslation", "withTranslation"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
tsx: [
|
|
||||||
{
|
|
||||||
lexer: "JsxLexer",
|
|
||||||
functions: ["t", "translatedError"],
|
|
||||||
namespaceFunctions: ["useTranslation", "withTranslation"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
locales: ["en"],
|
|
||||||
output: "locales/$LOCALE/$NAMESPACE.json",
|
|
||||||
input: ["src/**/*.{ts,tsx}"],
|
|
||||||
sort: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { defineConfig } from "i18next-cli";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
locales: ["en"],
|
||||||
|
extract: {
|
||||||
|
input: ["src/**/*.{ts,tsx}"],
|
||||||
|
output: "locales/{{language}}/{{namespace}}.json",
|
||||||
|
defaultNS: "app",
|
||||||
|
keySeparator: ".",
|
||||||
|
nsSeparator: false,
|
||||||
|
contextSeparator: "|",
|
||||||
|
extractFromComments: false,
|
||||||
|
functions: ["t", "*.t", "translatedError", "i18nKey"],
|
||||||
|
transComponents: ["Trans"],
|
||||||
|
},
|
||||||
|
types: {
|
||||||
|
input: ["locales/{{language}}/{{namespace}}.json"],
|
||||||
|
output: "src/types/i18next.d.ts",
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -11,7 +11,7 @@ export default {
|
|||||||
vite: {
|
vite: {
|
||||||
config: ["vite.config.ts", "vite-embedded.config.ts", "vite-sdk.config.ts"],
|
config: ["vite.config.ts", "vite-embedded.config.ts", "vite-sdk.config.ts"],
|
||||||
},
|
},
|
||||||
entry: ["src/main.tsx", "i18next-parser.config.ts"],
|
entry: ["src/main.tsx", "i18next.config.ts"],
|
||||||
ignoreBinaries: [
|
ignoreBinaries: [
|
||||||
// This is deprecated, so Knip doesn't actually recognize it as a globally
|
// This is deprecated, so Knip doesn't actually recognize it as a globally
|
||||||
// installed binary. TODO We should switch to Compose v2:
|
// installed binary. TODO We should switch to Compose v2:
|
||||||
|
|||||||
+3
-3
@@ -24,8 +24,8 @@
|
|||||||
"lint:eslint-fix": "eslint --max-warnings 0 src playwright --fix",
|
"lint:eslint-fix": "eslint --max-warnings 0 src playwright --fix",
|
||||||
"lint:knip": "knip",
|
"lint:knip": "knip",
|
||||||
"lint:types": "tsc",
|
"lint:types": "tsc",
|
||||||
"i18n": "i18next",
|
"i18n": "npx i18next-cli extract",
|
||||||
"i18n:check": "i18next --fail-on-warnings --fail-on-update",
|
"i18n:check": "npx i18next-cli extract --ci",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"test:storybook": "vitest --project=storybook",
|
"test:storybook": "vitest --project=storybook",
|
||||||
"test:unit": "vitest --project=unit",
|
"test:unit": "vitest --project=unit",
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
"global-jsdom": "^26.0.0",
|
"global-jsdom": "^26.0.0",
|
||||||
"i18next": "^25.0.0",
|
"i18next": "^25.0.0",
|
||||||
"i18next-browser-languagedetector": "^8.0.0",
|
"i18next-browser-languagedetector": "^8.0.0",
|
||||||
"i18next-parser": "^9.1.0",
|
"i18next-cli": "^1.61.0",
|
||||||
"jsdom": "^26.0.0",
|
"jsdom": "^26.0.0",
|
||||||
"knip": "^5.86.0",
|
"knip": "^5.86.0",
|
||||||
"livekit-client": "^2.18.1",
|
"livekit-client": "^2.18.1",
|
||||||
|
|||||||
Generated
+843
-744
File diff suppressed because it is too large
Load Diff
+8
-6
@@ -8,6 +8,8 @@ Please see LICENSE in the repository root for full details.
|
|||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
import { type ConnectionError } from "livekit-client";
|
import { type ConnectionError } from "livekit-client";
|
||||||
|
|
||||||
|
import { i18nKey } from "./i18n";
|
||||||
|
|
||||||
export enum ErrorCode {
|
export enum ErrorCode {
|
||||||
/**
|
/**
|
||||||
* Configuration problem due to no MatrixRTC backend/SFU is exposed via .well-known and no fallback configured.
|
* Configuration problem due to no MatrixRTC backend/SFU is exposed via .well-known and no fallback configured.
|
||||||
@@ -251,9 +253,9 @@ export class PeerConnectionTimeoutError extends ElementCallError {
|
|||||||
ErrorCode.SFU_ERROR,
|
ErrorCode.SFU_ERROR,
|
||||||
ErrorCategory.NETWORK_CONNECTIVITY,
|
ErrorCategory.NETWORK_CONNECTIVITY,
|
||||||
);
|
);
|
||||||
// Mark translation key for i18n extraction
|
this.localisedMessageKey = i18nKey(
|
||||||
// t("error.peer_connection_timeout_description");
|
"error.peer_connection_timeout_description",
|
||||||
this.localisedMessageKey = "error.peer_connection_timeout_description";
|
);
|
||||||
this.localisedMessageValues = {
|
this.localisedMessageValues = {
|
||||||
linkUrl:
|
linkUrl:
|
||||||
"https://docs.element.io/latest/element-server-suite-pro/configuring-components/configuring-matrix-rtc/#sfu-connectivity-troubleshooting",
|
"https://docs.element.io/latest/element-server-suite-pro/configuring-components/configuring-matrix-rtc/#sfu-connectivity-troubleshooting",
|
||||||
@@ -268,9 +270,9 @@ export class LivekitConnectionError extends ElementCallError {
|
|||||||
ErrorCode.SFU_ERROR,
|
ErrorCode.SFU_ERROR,
|
||||||
ErrorCategory.NETWORK_CONNECTIVITY,
|
ErrorCategory.NETWORK_CONNECTIVITY,
|
||||||
);
|
);
|
||||||
// Mark translation key for i18n extraction
|
this.localisedMessageKey = i18nKey(
|
||||||
// t("error.livekit_connection_error_description");
|
"error.livekit_connection_error_description",
|
||||||
this.localisedMessageKey = "error.livekit_connection_error_description";
|
);
|
||||||
this.localisedMessageValues = { reason: cause.reasonName };
|
this.localisedMessageValues = { reason: cause.reasonName };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2026 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Custom marker function to allow i18next extraction
|
||||||
|
export const i18nKey = (key: string): string => key;
|
||||||
Reference in New Issue
Block a user