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