diff --git a/.github/workflows/crowdin-export.yml b/.github/workflows/crowdin-export.yml index afd0cded..fca356b8 100644 --- a/.github/workflows/crowdin-export.yml +++ b/.github/workflows/crowdin-export.yml @@ -14,20 +14,38 @@ jobs: with: fetch-depth: 1 token: ${{secrets.GITHUB_TOKEN}} + - name: Test using Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v6 with: - node-version: "v22" - - name: Install ts-node - run: npm i -g ts-node + node-version: "lts/*" + - name: Install dependencies run: npm install + - name: Export translations - run: ts-node --project ./tsconfig.node.json ./script/crowdin/export-translation.ts + run: | + npx ts-node --project ./tsconfig.node.json ./script/crowdin/export-translation.ts 2>&1 | tee /tmp/export-output.log + exit ${PIPESTATUS[0]} + continue-on-error: true + + - name: Check exporting logs + if: always() + run: | + if grep -q "[CROWDIN-ERROR]" /tmp/export-output.log; then + echo "::error:: Found errors in export logs" + exit 1 + else + echo "No errors found in export logs" + fi + - name: Test typescript - uses: icrawl/action-tsc@v1 + if: success() + run: npx tsc --noEmit + - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 + if: success() + uses: peter-evans/create-pull-request@v8 with: commit-message: "i18n(download): download translations by bot" branch: crowdin-export/patch diff --git a/package.json b/package.json index 8e358d1c..2a846995 100644 --- a/package.json +++ b/package.json @@ -34,17 +34,17 @@ "@rsdoctor/rspack-plugin": "^1.5.2", "@rspack/cli": "^1.7.6", "@rspack/core": "^1.7.6", - "@swc/core": "^1.15.11", + "@swc/core": "^1.15.13", "@swc/jest": "^0.2.39", - "@types/chrome": "0.1.36", + "@types/chrome": "0.1.37", "@types/decompress": "^4.2.7", "@types/jest": "^30.0.0", - "@types/node": "^25.2.3", + "@types/node": "^25.3.0", "@types/punycode": "^2.1.4", "@vue/babel-plugin-jsx": "^2.0.1", "babel-loader": "^10.0.0", - "commitlint": "^20.4.1", - "css-loader": "^7.1.3", + "commitlint": "^20.4.2", + "css-loader": "^7.1.4", "decompress": "^4.2.1", "husky": "^9.1.7", "jest": "^30.2.0", @@ -52,9 +52,9 @@ "jest-junit": "^16.0.0", "jszip": "^3.10.1", "postcss": "^8.5.6", - "postcss-loader": "^8.2.0", + "postcss-loader": "^8.2.1", "postcss-rtlcss": "^5.7.1", - "puppeteer": "^24.37.2", + "puppeteer": "^24.37.5", "ts-loader": "^9.5.4", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", @@ -66,9 +66,9 @@ "element-plus": "2.13.2", "punycode": "^2.3.1", "vue": "^3.5.28", - "vue-router": "^5.0.2" + "vue-router": "^5.0.3" }, "engines": { "node": ">=22" } -} +} \ No newline at end of file diff --git a/script/crowdin/common.ts b/script/crowdin/common.ts index 8971278c..0a568e5c 100644 --- a/script/crowdin/common.ts +++ b/script/crowdin/common.ts @@ -139,7 +139,7 @@ export async function mergeMessage( const filePath = path.join(dirPath, filename) const existMessages = (await import(`@i18n/message/${dir}/${filename}`))?.default as Messages if (!existMessages) { - console.error(`Failed to find local code: dir=${dir}, filename=${filename}`) + logError(`Failed to find local code: dir=${dir}, filename=${filename}`) return } const sourceItemSet = transMsg(existMessages[SOURCE_LOCALE]) @@ -155,7 +155,7 @@ export async function mergeMessage( // Deleted key if (!sourceText) return if (!checkPlaceholder(text, sourceText)) { - console.error(`Invalid placeholder: dir=${dir}, filename=${filename}, path=${path}, source=${sourceText}, translated=${text}`) + logError(`Invalid placeholder: dir=${dir}, filename=${filename}, path=${path}, source=${sourceText}, translated=${text}`) return } const pathSeg = path.split('.') @@ -168,6 +168,10 @@ export async function mergeMessage( fs.writeFileSync(filePath, newFileContent, { encoding: 'utf-8' }) } +function logError(msg: string) { + console.error(`[CROWDIN-ERROR] ${msg}`) +} + function checkPlaceholder(translated: string, source: string) { const allSourcePlaceholders = Array.from(source.matchAll(/\{(.*?)\}/g)) diff --git a/src/i18n/message/app/dashboard-resource.json b/src/i18n/message/app/dashboard-resource.json index f36cc5e9..ba228606 100644 --- a/src/i18n/message/app/dashboard-resource.json +++ b/src/i18n/message/app/dashboard-resource.json @@ -284,7 +284,7 @@ }, "pl": { "heatMap": { - "title0": "Przeglądano przez {hour} godzin(y) w zeszłym roku", + "title0": "Przeglądano przez {hour} godzin w zeszłym roku", "title1": "Przeglądano mniej niż 1 godzinę w ubiegłym roku" }, "topK": { diff --git a/tsconfig.json b/tsconfig.json index 0dfc5b40..8c8d779c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "DOM" ], "types": [ - "jest" + "jest", + "chrome" ], "jsx": "preserve", "jsxFactory": "h",