doc: Make the badges clickable and redirect to the TRANSLATION.md (#601)
Some checks failed
Continuous Integration / Build (push) Has been cancelled
Continuous Integration / Prepare version string (push) Has been cancelled
Localization Check / localization-check (push) Has been cancelled
Continuous Integration / Package (push) Has been cancelled

* Make the badges clickable and redirect to the TRANSLATION.md
* Move localization check script file position

---------

Signed-off-by: Gadfly <gadfly@gadfly.vip>
This commit is contained in:
GadflyFang 2024-10-25 14:51:49 +08:00 committed by GitHub
parent 7e1624c2d6
commit 28773f0e2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ jobs:
run: npm install fs-extra@11.2.0 path@0.12.7 xml2js@0.6.2 run: npm install fs-extra@11.2.0 path@0.12.7 xml2js@0.6.2
- name: Run localization check - name: Run localization check
run: node .github/scripts/localization-check.js run: node build/scripts/localization-check.js
- name: Commit changes - name: Commit changes
run: | run: |

View file

@ -43,7 +43,7 @@
## Translation Status ## Translation Status
![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) [![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)
## How to Use ## How to Use

View file

@ -25,7 +25,7 @@ async function calculateTranslationRate() {
const files = (await fs.readdir(localesDir)).filter(file => file !== 'en_US.axaml' && file.endsWith('.axaml')); const files = (await fs.readdir(localesDir)).filter(file => file !== 'en_US.axaml' && file.endsWith('.axaml'));
// Add en_US badge first // Add en_US badge first
badges.push(`![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)`); badges.push(`[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md)`);
for (const file of files) { for (const file of files) {
const filePath = path.join(localesDir, file); const filePath = path.join(localesDir, file);
@ -41,12 +41,12 @@ async function calculateTranslationRate() {
// Add badges // Add badges
const locale = file.replace('.axaml', '').replace('_', '__'); const locale = file.replace('.axaml', '').replace('_', '__');
const badgeColor = translationRate === 100 ? 'brightgreen' : translationRate >= 75 ? 'yellow' : 'red'; const badgeColor = translationRate === 100 ? 'brightgreen' : translationRate >= 75 ? 'yellow' : 'red';
badges.push(`![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})`); badges.push(`[![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})](TRANSLATION.md)`);
} }
console.log(translationRates.join('\n\n')); console.log(translationRates.join('\n\n'));
await fs.writeFile(outputFile, translationRates.join('\n\n'), 'utf8'); await fs.writeFile(outputFile, translationRates.join('\n\n') + '\n', 'utf8');
// Update README.md // Update README.md
let readmeContent = await fs.readFile(readmeFile, 'utf8'); let readmeContent = await fs.readFile(readmeFile, 'utf8');