From 75288e7a310ff041ad54184d2389665e9dedfdee Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 22 Jan 2025 11:19:48 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20replacing=20`100%`=20and=20`100.00%`=20wi?= =?UTF-8?q?th=20`=E2=88=9A`=20for=20translation=20progress=20in=20README.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/scripts/localization-check.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build/scripts/localization-check.js b/build/scripts/localization-check.js index 45db82be..76b5036b 100644 --- a/build/scripts/localization-check.js +++ b/build/scripts/localization-check.js @@ -25,7 +25,7 @@ async function calculateTranslationRate() { const files = (await fs.readdir(localesDir)).filter(file => file !== 'en_US.axaml' && file.endsWith('.axaml')); // Add en_US badge first - badges.push(`[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md)`); + badges.push(`[![en_US](https://img.shields.io/badge/en_US-%E2%88%9A-brightgreen)](TRANSLATION.md)`); for (const file of files) { const filePath = path.join(localesDir, file); @@ -40,8 +40,12 @@ async function calculateTranslationRate() { // Add badges const locale = file.replace('.axaml', '').replace('_', '__'); - const badgeColor = translationRate === 100 ? 'brightgreen' : translationRate >= 75 ? 'yellow' : 'red'; - badges.push(`[![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})](TRANSLATION.md)`); + if (translationRate === 100) { + badges.push(`[![${locale}](https://img.shields.io/badge/${locale}-%E2%88%9A-brightgreen)](TRANSLATION.md)`); + } else { + const badgeColor = translationRate >= 75 ? 'yellow' : 'red'; + badges.push(`[![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})](TRANSLATION.md)`); + } } console.log(translationRates.join('\n\n'));