Skip to content

Commit 28773f0

Browse files
authored
doc: Make the badges clickable and redirect to the TRANSLATION.md (#601)
* Make the badges clickable and redirect to the TRANSLATION.md * Move localization check script file position --------- Signed-off-by: Gadfly <[email protected]>
1 parent 7e1624c commit 28773f0

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

.github/workflows/localization-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
2626

2727
- name: Run localization check
28-
run: node .github/scripts/localization-check.js
28+
run: node build/scripts/localization-check.js
2929

3030
- name: Commit changes
3131
run: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
4444
## Translation Status
4545

46-
![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen) ![de__DE](https://img.shields.io/badge/de__DE-98.95%25-yellow) ![fr__FR](https://img.shields.io/badge/fr__FR-90.36%25-yellow) ![pt__BR](https://img.shields.io/badge/pt__BR-93.52%25-yellow) ![ru__RU](https://img.shields.io/badge/ru__RU-98.80%25-yellow) ![zh__CN](https://img.shields.io/badge/zh__CN-99.10%25-yellow) ![zh__TW](https://img.shields.io/badge/zh__TW-99.70%25-yellow)
46+
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.95%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-90.36%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-93.52%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.80%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.10%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.70%25-yellow)](TRANSLATION.md)
4747

4848
## How to Use
4949

TRANSLATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@
180180
- Text.Preference.AI.AnalyzeDiffPrompt
181181
- Text.Preference.AI.GenerateSubjectPrompt
182182

183-
</details>
183+
</details>

.github/scripts/localization-check.js renamed to build/scripts/localization-check.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function calculateTranslationRate() {
2525
const files = (await fs.readdir(localesDir)).filter(file => file !== 'en_US.axaml' && file.endsWith('.axaml'));
2626

2727
// Add en_US badge first
28-
badges.push(`![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)`);
28+
badges.push(`[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md)`);
2929

3030
for (const file of files) {
3131
const filePath = path.join(localesDir, file);
@@ -41,12 +41,12 @@ async function calculateTranslationRate() {
4141
// Add badges
4242
const locale = file.replace('.axaml', '').replace('_', '__');
4343
const badgeColor = translationRate === 100 ? 'brightgreen' : translationRate >= 75 ? 'yellow' : 'red';
44-
badges.push(`![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})`);
44+
badges.push(`[![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})](TRANSLATION.md)`);
4545
}
4646

4747
console.log(translationRates.join('\n\n'));
4848

49-
await fs.writeFile(outputFile, translationRates.join('\n\n'), 'utf8');
49+
await fs.writeFile(outputFile, translationRates.join('\n\n') + '\n', 'utf8');
5050

5151
// Update README.md
5252
let readmeContent = await fs.readFile(readmeFile, 'utf8');

0 commit comments

Comments
 (0)