diff --git a/README.md b/README.md index f2f7c72a96..81e34dc058 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ Current translations:   | Language | Code | Last translator | Percent done ---|---|---|---|--- -![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/es/basque_country.png) | Basque | eu | | 89% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/es/basque_country.png) | Basque | eu | juan.abasolo@ehu.eus | 89% ![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/hr.png) | Croatian | hr_HR | Hrvoje Mandić | 72% ![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/de.png) | Deutsch | de_DE | Tobias Strobel | 91% ![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/gb.png) | English | en_GB | | 100% diff --git a/Tools/build-translation.js b/Tools/build-translation.js index 9938bb418f..9fc6b7e840 100644 --- a/Tools/build-translation.js +++ b/Tools/build-translation.js @@ -108,6 +108,23 @@ function availableLocales(defaultLocale) { return output; } +function extractTranslator(regex, poContent) { + const translatorMatch = poContent.match(regex); + let translatorName = ''; + + if (translatorMatch && translatorMatch.length >= 1) { + translatorName = translatorMatch[1]; + translatorName = translatorName.replace(/["\s]+$/, ''); + translatorName = translatorName.replace(/\\n$/, ''); + translatorName = translatorName.replace(/^\s*/, ''); + } + + if (translatorName.indexOf('FULL NAME') >= 0) return ''; + if (translatorName.indexOf('LL@li.org') >= 0) return ''; + + return translatorName; +} + async function translationStatus(isDefault, poFile) { // "apt install translate-toolkit" to have pocount const command = 'pocount "' + poFile + '"'; @@ -120,17 +137,26 @@ async function translationStatus(isDefault, poFile) { let translatorName = ''; const content = await fs.readFile(poFile, 'utf-8'); - // "Last-Translator: Hrvoje Mandić \n" - const translatorMatch = content.match(/Last-Translator:\s*?(.*)/); - - if (translatorMatch.length >= 1) { - translatorName = translatorMatch[1]; - translatorName = translatorName.replace(/["\s]+$/, ''); - translatorName = translatorName.replace(/\\n$/, ''); - translatorName = translatorName.replace(/^\s*/, ''); + + translatorName = extractTranslator(/Last-Translator:\s*?(.*)/, content); + if (!translatorName) { + translatorName = extractTranslator(/Language-Team:\s*?(.*)/, content); } - if (translatorName.indexOf('FULL NAME') >= 0) translatorName = ''; + // "Last-Translator: Hrvoje Mandić \n" + // let translatorMatch = content.match(/Last-Translator:\s*?(.*)/); + // if (translatorMatch.length < 1) { + // translatorMatch = content.match(/Last-Team:\s*?(.*)/); + // } + + // if (translatorMatch.length >= 1) { + // translatorName = translatorMatch[1]; + // translatorName = translatorName.replace(/["\s]+$/, ''); + // translatorName = translatorName.replace(/\\n$/, ''); + // translatorName = translatorName.replace(/^\s*/, ''); + // } + + // if (translatorName.indexOf('FULL NAME') >= 0) translatorName = ''; return { percentDone: isDefault ? 100 : percentDone, diff --git a/docs/index.html b/docs/index.html index 187e56bd34..0776cad1f3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -378,21 +378,21 @@ $$ Basque eu - +juan.abasolo@ehu.eus 89% Croatian hr_HR -Hrvoje Mandić trbuhom@net.hr +Hrvoje Mandić trbuhom@net.hr 72% Deutsch de_DE -Tobias Strobel git@strobeltobias.de +Tobias Strobel git@strobeltobias.de 91% @@ -448,14 +448,14 @@ $$ Русский ru_RU -Artyom Karlov artyom.karlov@gmail.com +Artyom Karlov artyom.karlov@gmail.com 94% 中文 (简体) zh_CN -RCJacH RCJacH@outlook.com +RCJacH RCJacH@outlook.com 75%