From a6a2c1f3a1762f73d24fd55775385c958026e5a2 Mon Sep 17 00:00:00 2001 From: "Ibrahima G. Coulibaly" Date: Mon, 14 Jul 2025 16:06:29 +0100 Subject: [PATCH] chore: saveMissing --- package-lock.json | 4 +++- package.json | 8 ++++---- src/i18n/index.ts | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 25330f5..f89ce29 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,6 @@ "formik": "^2.4.6", "i18next": "^25.3.2", "i18next-http-backend": "^3.0.2", - "i18next-locize-backend": "^7.0.4", "jimp": "^0.22.12", "js-quantities": "^1.8.0", "jszip": "^3.10.1", @@ -91,6 +90,7 @@ "eslint-plugin-tailwindcss": "^3.17.0", "happy-dom": "^12.10.3", "husky": "^9.0.11", + "i18next-locize-backend": "^7.0.4", "locize-cli": "^10.1.1", "postcss": "^8.4.38", "prettier": "3.1.1", @@ -5097,6 +5097,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.1.0.tgz", "integrity": "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==", + "dev": true, "license": "MIT", "dependencies": { "node-fetch": "^2.7.0" @@ -7130,6 +7131,7 @@ "version": "7.0.4", "resolved": "https://registry.npmjs.org/i18next-locize-backend/-/i18next-locize-backend-7.0.4.tgz", "integrity": "sha512-saRyIQAX0k+YA6XzirU6cyudWDj1W7bGDz/Szq+8OIs3JJnNuMZCADuNgCwmo+dQm9P69bbALymV+9t9ffywBA==", + "dev": true, "license": "MIT", "dependencies": { "cross-fetch": "4.1.0" diff --git a/package.json b/package.json index 6e579aa..af2ba56 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,8 @@ }, "scripts": { "dev": "vite", - "prebuild": "npm run download-translations", + "prebuild": "npm run i18n:pull", "build": "tsc && vite build", - "download-translations": "locize download --project-id e7156a3e-66fb-4035-a0f0-cebf1c63a3ba --api-key $LOCIZE_API_KEY --path ./public/locales", "serve": "vite preview", "test": "vitest", "test:e2e": "playwright test", @@ -24,7 +23,8 @@ "script:create:tool": "node scripts/create-tool.mjs", "lint": "eslint src --max-warnings=0 --fix", "typecheck": "tsc --project tsconfig.json --noEmit", - "prepare": "husky install" + "prepare": "husky install", + "i18n:pull": "locize download --project-id e7156a3e-66fb-4035-a0f0-cebf1c63a3ba --api-key $LOCIZE_API_KEY --path ./public/locales" }, "dependencies": { "@emotion/react": "^11.11.4", @@ -54,7 +54,6 @@ "formik": "^2.4.6", "i18next": "^25.3.2", "i18next-http-backend": "^3.0.2", - "i18next-locize-backend": "^7.0.4", "jimp": "^0.22.12", "js-quantities": "^1.8.0", "jszip": "^3.10.1", @@ -110,6 +109,7 @@ "eslint-plugin-tailwindcss": "^3.17.0", "happy-dom": "^12.10.3", "husky": "^9.0.11", + "i18next-locize-backend": "^7.0.4", "locize-cli": "^10.1.1", "postcss": "^8.4.38", "prettier": "3.1.1", diff --git a/src/i18n/index.ts b/src/i18n/index.ts index fe3b3c0..536051e 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -42,11 +42,14 @@ export type FullI18nKey = { i18n.use(initReactI18next).init({ lng: 'en', fallbackLng: 'en', + debug: useLocize, backend: useLocize ? locizeOptions : { loadPath: '/locales/{{lng}}/{{ns}}.json' - } + }, + saveMissing: useLocize, + updateMissing: useLocize }); export default i18n;