Update localization files for backup destinations and API client credentials

- Changed references from E3 to S3 in Russian, Simplified Chinese, and Traditional Chinese localization files.
- Updated the corresponding keys and descriptions to reflect the change in backup destination protocols.
- Improved the Vite configuration to dynamically match locale files, simplifying the code for locale handling.
This commit is contained in:
shuaiplus
2026-04-30 15:03:05 +08:00
parent 9c5fbda374
commit 0c00114cc8
19 changed files with 1232 additions and 201 deletions
+23 -8
View File
@@ -1,11 +1,4 @@
const { readLocale } = require('./i18n-utils.cjs');
const localeFiles = [
['en', 'en.ts', 'en'],
['zh-CN', 'zh-CN.ts', 'zhCN'],
['zh-TW', 'zh-TW.ts', 'zhTW'],
['ru', 'ru.ts', 'ru'],
];
const { localeFiles, readLocale } = require('./i18n-utils.cjs');
const locales = Object.fromEntries(
localeFiles.map(([locale, fileName, variableName]) => [locale, readLocale(fileName, variableName)])
@@ -14,6 +7,17 @@ const base = locales.en;
const baseKeys = Object.keys(base).sort();
const placeholderRe = /\{\w+\}/g;
const errors = [];
const intentionallyEnglishKeys = new Set([
'txt_backup_destination_detail_note',
'txt_backup_protocol_webdav',
'txt_backup_protocol_s3',
'txt_backup_recommend_group_webdav',
'txt_backup_recommend_group_s3',
'txt_backup_destination_name_default_webdav',
'txt_backup_destination_name_default_s3',
'txt_dash',
'txt_text_3',
]);
for (const [locale, table] of Object.entries(locales)) {
const keys = Object.keys(table).sort();
@@ -30,6 +34,17 @@ for (const [locale, table] of Object.entries(locales)) {
errors.push({ locale, key, basePlaceholders, localePlaceholders });
}
}
if (locale !== 'en') {
const sameAsEnglish = baseKeys.filter((key) => table[key] === base[key] && !intentionallyEnglishKeys.has(key));
if (sameAsEnglish.length > 40) {
errors.push({
locale,
sameAsEnglishCount: sameAsEnglish.length,
sameAsEnglishSample: sameAsEnglish.slice(0, 25),
});
}
}
}
console.log(JSON.stringify({