diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5d196a084..2109284666 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -298,9 +298,9 @@ jobs: cache: 'pnpm' cache-dependency-path: '**/pnpm-lock.yaml' - name: Install dependencies - run: pnpm --filter=immich-web install --frozen-lockfile + run: pnpm --filter=immich-i18n install --frozen-lockfile - name: Format - run: pnpm --filter=immich-web format:i18n + run: pnpm --filter=immich-i18n format:fix - name: Find file changes uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20.0.4 id: verify-changed-files diff --git a/i18n/.prettierrc b/i18n/.prettierrc new file mode 100644 index 0000000000..30581eb7d1 --- /dev/null +++ b/i18n/.prettierrc @@ -0,0 +1,5 @@ +{ + "jsonRecursiveSort": true, + "jsonSortOrder": "{\"/.*/\": \"lexical\"}", + "plugins": ["prettier-plugin-sort-json"] +} diff --git a/i18n/package.json b/i18n/package.json new file mode 100644 index 0000000000..19d78c49b7 --- /dev/null +++ b/i18n/package.json @@ -0,0 +1,13 @@ +{ + "name": "immich-i18n", + "version": "1.0.0", + "private": true, + "scripts": { + "format": "prettier --check .", + "format:fix": "prettier --write ." + }, + "devDependencies": { + "prettier": "^3.7.4", + "prettier-plugin-sort-json": "^4.1.1" + } +} diff --git a/mise.toml b/mise.toml index 0b61f3c26a..d7ee798e48 100644 --- a/mise.toml +++ b/mise.toml @@ -34,4 +34,4 @@ run = { task = ":i18n:format-fix" } [tasks."i18n:format-fix"] dir = "i18n" -run = "pnpm dlx sort-json *.json" +run = "pnpm run format:fix" diff --git a/mobile/makefile b/mobile/makefile index b90e95c902..3b211bcd09 100644 --- a/mobile/makefile +++ b/mobile/makefile @@ -33,7 +33,7 @@ migration: dart run drift_dev make-migrations translation: - npm --prefix ../web run format:i18n + npm --prefix ../i18n run format:fix dart run easy_localization:generate -S ../i18n dart run bin/generate_keys.dart dart format lib/generated/codegen_loader.g.dart diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 27c6c3f290..1ca4052e10 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -292,6 +292,15 @@ importers: specifier: ^3.0.0 version: 3.2.4(@types/debug@4.1.12)(@types/node@24.10.4)(happy-dom@20.0.11)(jiti@2.6.1)(jsdom@20.0.3(canvas@2.11.2(encoding@0.1.13)))(lightningcss@1.30.2)(terser@5.44.1)(yaml@2.8.2) + i18n: + devDependencies: + prettier: + specifier: ^3.7.4 + version: 3.7.4 + prettier-plugin-sort-json: + specifier: ^4.1.1 + version: 4.1.1(prettier@3.7.4) + open-api/typescript-sdk: dependencies: '@oazapfts/runtime': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 33aaa744b0..c7ec4739ae 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,6 +2,7 @@ packages: - cli - docs - e2e + - i18n - open-api/typescript-sdk - server - plugins diff --git a/web/package.json b/web/package.json index 4b3e4587fc..b5c972cec2 100644 --- a/web/package.json +++ b/web/package.json @@ -17,8 +17,7 @@ "lint": "eslint . --max-warnings 0 --concurrency 4", "lint:fix": "pnpm run lint --fix", "format": "prettier --check .", - "format:fix": "prettier --write . && pnpm run format:i18n", - "format:i18n": "pnpm dlx sort-json ../i18n/*.json", + "format:fix": "prettier --write .", "test": "vitest --run", "test:cov": "vitest --coverage", "test:watch": "vitest dev", diff --git a/web/src/lib/i18n.spec.ts b/web/src/lib/i18n.spec.ts index 63aae0419c..325e7bad5e 100644 --- a/web/src/lib/i18n.spec.ts +++ b/web/src/lib/i18n.spec.ts @@ -7,6 +7,10 @@ describe('i18n', () => { const languageFiles = readdirSync('../i18n').sort(); for (const filename of languageFiles) { test(`${filename} should have a loader`, async () => { + if (!filename.endsWith('.json') || filename == 'package.json') { + return; + } + const code = filename.replaceAll('.json', ''); const item = langs.find((lang) => lang.weblateCode === code || lang.code === code); expect(item, `${filename} has no loader`).toBeDefined();