Migrate from i18next-parser to i18next-cli

This commit is contained in:
Quentin Gliech
2025-11-07 14:45:36 +01:00
parent 30044d1f05
commit e7e2a46d2d
5 changed files with 916 additions and 1523 deletions

View File

@@ -1,33 +0,0 @@
// Copyright 2024, 2025 New Vector Ltd.
// Copyright 2023, 2024 The Matrix.org Foundation C.I.C.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
import type { UserConfig } from "i18next-parser";
export default {
keySeparator: ".",
pluralSeparator: ":",
defaultNamespace: "frontend",
lexers: {
ts: [
{
lexer: "JavascriptLexer",
functions: ["t"],
namespaceFunctions: ["useTranslation", "withTranslation"],
},
],
tsx: [
{
lexer: "JsxLexer",
functions: ["t"],
namespaceFunctions: ["useTranslation", "withTranslation"],
},
],
},
locales: ["en"],
output: "locales/$LOCALE.json",
input: ["src/**/*.{ts,tsx}"],
sort: true,
} satisfies UserConfig;

View File

@@ -0,0 +1,18 @@
// Copyright 2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
import { defineConfig } from "i18next-cli";
export default defineConfig({
locales: ["en"],
extract: {
input: "src/**/*.{ts,tsx}",
output: "locales/{{language}}.json",
defaultNS: false,
pluralSeparator: ":",
keySeparator: ".",
sort: true,
},
});

View File

@@ -287,9 +287,6 @@
"delete_button_title": "Remove email address",
"email": "Email"
},
"user_email_list": {
"no_primary_email_alert": "No primary email address"
},
"user_sessions_overview": {
"heading": "Where you're signed in",
"no_active_sessions": {

File diff suppressed because it is too large Load Diff

View File

@@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"generate": "graphql-codegen && i18next",
"lint": "graphql-codegen && biome check && tsc && i18next --fail-on-warnings --fail-on-update",
"generate": "graphql-codegen && i18next-cli extract",
"lint": "graphql-codegen && biome check && tsc && i18next-cli extract --ci",
"format": "biome format --write",
"build": "rimraf ./dist/ && vite build",
"preview": "vite preview",
@@ -14,7 +14,7 @@
"coverage": "vitest run --coverage",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"i18n": "i18next",
"i18n": "i18next-cli",
"knip": "knip"
},
"dependencies": {
@@ -64,7 +64,7 @@
"browserslist-to-esbuild": "^2.1.1",
"graphql": "^16.11.0",
"happy-dom": "^20.0.4",
"i18next-parser": "^9.3.0",
"i18next-cli": "^1.22.1",
"knip": "^5.66.4",
"msw": "^2.11.6",
"msw-storybook-addon": "^2.0.5",