Merge pull request #38 from congweibai/feature/sortting-country-by-alpha

feat: 确保国家选项按照各个语言的顺序 而不是Unicode
This commit is contained in:
Zylan
2025-04-03 16:06:10 +08:00
committed by GitHub

View File

@@ -1230,7 +1230,7 @@ const SalaryCalculator = () => {
// 确保中国始终排在第一位
if (a === 'CN') return -1;
if (b === 'CN') return 1;
return getCountryName(a).localeCompare(getCountryName(b));
return new Intl.Collator(['zh', 'ja', 'en']).compare(getCountryName(a), getCountryName(b));
}).map(code => (
<option key={code} value={code}>
{getCountryName(code)} ({pppFactors[code].toFixed(2)})