From 0bcac0ed427cec2a10b53b2007cacada73268875 Mon Sep 17 00:00:00 2001 From: Kout95 <65901733+Kout95@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:03:04 +0200 Subject: [PATCH] fix: i18n are not loaded because is dynamically import (#199) Copy `generated` i18n files to public to allow bundle to import it dynamically --- .gitignore | 3 ++- .pre-commit-config.yaml | 1 - frontend/package.json | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 612d3e6c..8dab0a74 100644 --- a/.gitignore +++ b/.gitignore @@ -120,4 +120,5 @@ dmypy.json /frontend/lib/ /frontend/test/ /frontend/public/dist/ -/frontend/src/localization/generated/ \ No newline at end of file +/frontend/src/localization/generated/ +/frontend/public/generated/ \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 750d484d..c11a4805 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,4 +37,3 @@ repos: name: "Check if translations files in 'frontend/xliff' need to be updated" entry: make check_translations language: system - files: '\.(ts|json|xlf)$' diff --git a/frontend/package.json b/frontend/package.json index 3fab6149..b0c20d69 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,9 +9,10 @@ "type": "module", "scripts": { "//build": "echo 'compile typescript files'", - "build": "npm run translations:build && tsc", + "build": "npm run translations:build && tsc && npm run translations:copy", "build:watch": "npm run translations:build && tsc --watch", "translations:build": "lit-localize build", + "translations:copy": "cp -r public/dist/localization/generated public/generated", "translations:extract": "lit-localize extract", "clean": "rimraf search-a-licious.{d.ts,d.ts.map,js,js.map} test/search-a-licious.{d.ts,d.ts.map,js,js.map} test/search-a-licious_test.{d.ts,d.ts.map,js,js.map}", "lint": "npm run lint:lit-analyzer && npm run lint:eslint",