[SKIP CI][Tooling] Update translation changelog script

Weblate changed the language names of chinese simplified and traditional to include "Han script".
This messed up the updated language detection
This commit is contained in:
schroda
2024-09-01 01:18:24 +02:00
parent 2733c06fe1
commit 395092099a

View File

@@ -178,7 +178,7 @@ const getUsername = async (url: string, authToken: string): Promise<string> => {
const getLanguageName = async (url: string, authToken: string): Promise<string> => { const getLanguageName = async (url: string, authToken: string): Promise<string> => {
const languagePayload = await fetchData<WeblateLanguagePayload>(url, authToken); const languagePayload = await fetchData<WeblateLanguagePayload>(url, authToken);
return languagePayload.language.name; return languagePayload.language.name.replace(/\(([a-zA-Z]+) Han script\)/g, '($1)');
}; };
const extractContributionInfoFromChanges = ( const extractContributionInfoFromChanges = (
@@ -381,15 +381,20 @@ const createTranslationChangelog = async (): Promise<void> => {
'Thank you for your contribution to the translation of the project.\n', 'Thank you for your contribution to the translation of the project.\n',
); );
console.log('### Added'); if (newLanguages.length) {
newLanguages.forEach(({ language, contributors }) => { console.log('### Added');
console.log(`- ${language} (by ${contributors.join(', ')})`); newLanguages.forEach(({ language, contributors }) => {
}); console.log(`- ${language} (by ${contributors.join(', ')})`);
console.log(''); });
console.log('### Updated'); console.log('');
updatedLanguages.forEach(({ language, contributors }) => { }
console.log(`- ${language} (by ${contributors.join(', ')})`);
}); if (updatedLanguages.length) {
console.log('### Updated');
updatedLanguages.forEach(({ language, contributors }) => {
console.log(`- ${language} (by ${contributors.join(', ')})`);
});
}
}; };
createTranslationChangelog(); createTranslationChangelog();