Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/crowdin-export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@
"@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",
"jest-environment-jsdom": "^30.2.0",
"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",
Expand All @@ -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"
}
}
}
8 changes: 6 additions & 2 deletions script/crowdin/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>
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])
Expand All @@ -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('.')
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/message/app/dashboard-resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"DOM"
],
"types": [
"jest"
"jest",
"chrome"
],
"jsx": "preserve",
"jsxFactory": "h",
Expand Down