From 70adbe5e76f9e6e48df7b2b24cfca50c339ab74b Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 1 Feb 2018 20:21:54 +0000 Subject: [PATCH] Added flags --- README.md | 28 ++++++++++++++-------------- ReactNativeClient/lib/locale.js | 2 +- Tools/build-translation.js | 12 +++++++----- docs/index.html | 21 +++++++++++++++++---- 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 71c24098f..ae814b60a 100644 --- a/README.md +++ b/README.md @@ -160,20 +160,20 @@ This translation will apply to the three applications - desktop, mobile and term Current translations: -Language | Code | Last translator | Percent done ----|---|---|--- -Croatian | hr_HR | Hrvoje Mandić | 72% -Deutsch | de_DE | Tobias Strobel | 92% -English | en_GB | | 100% -Español | es_ES | Lucas Vieites | 80% -Español (Costa Rica) | es_CR | | 68% -Français | fr_FR | Laurent Cozic | 100% -Italiano | it_IT | | 76% -Nederlands | nl_BE | | 90% -Português (Brasil) | pt_BR | | 74% -Русский | ru_RU | Artyom Karlov | 96% -中文 (简体) | zh_CN | RCJacH | 76% -日本語 | ja_JP | | 74% +  | Language | Code | Last translator | Percent done +---|---|---|---|--- +![](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 | 92% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/gb.png) | English | en_GB | | 100% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/es.png) | Español | es_ES | Lucas Vieites | 80% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/cr.png) | Español (Costa Rica) | es_CR | | 68% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/fr.png) | Français | fr_FR | Laurent Cozic | 100% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/it.png) | Italiano | it_IT | | 76% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/be.png) | Nederlands | nl_BE | | 90% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/br.png) | Português (Brasil) | pt_BR | | 74% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/ru.png) | Русский | ru_RU | Artyom Karlov | 96% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/cn.png) | 中文 (简体) | zh_CN | RCJacH | 76% +![](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/jp.png) | 日本語 | ja_JP | | 74% # Contributing diff --git a/ReactNativeClient/lib/locale.js b/ReactNativeClient/lib/locale.js index b513be4da..f98614fef 100644 --- a/ReactNativeClient/lib/locale.js +++ b/ReactNativeClient/lib/locale.js @@ -297,4 +297,4 @@ function _(s, ...args) { return sprintf(result, ...args); } -module.exports = { _, supportedLocales, countryDisplayName, localeStrings, setLocale, supportedLocalesToLanguages, defaultLocale, closestSupportedLocale, languageCode }; \ No newline at end of file +module.exports = { _, supportedLocales, countryDisplayName, localeStrings, setLocale, supportedLocalesToLanguages, defaultLocale, closestSupportedLocale, languageCode, countryCodeOnly }; \ No newline at end of file diff --git a/Tools/build-translation.js b/Tools/build-translation.js index d31c882ed..8a6b05b2d 100644 --- a/Tools/build-translation.js +++ b/Tools/build-translation.js @@ -18,7 +18,7 @@ const rnDir = rootDir + '/ReactNativeClient'; const electronDir = rootDir + '/ElectronClient/app'; const { execCommand } = require('./tool-utils.js'); -const { countryDisplayName } = require('lib/locale.js'); +const { countryDisplayName, countryCodeOnly } = require('lib/locale.js'); function parsePoFile(filePath) { const content = fs.readFileSync(filePath); @@ -140,11 +140,12 @@ async function translationStatus(isDefault, poFile) { function translationStatusToMdTable(status) { let output = []; - output.push(['Language', 'Code', 'Last translator', 'Percent done'].join(' | ')); - output.push(['---', '---', '---', '---'].join('|')); + output.push([' ', 'Language', 'Code', 'Last translator', 'Percent done'].join(' | ')); + output.push(['---', '---', '---', '---', '---'].join('|')); for (let i = 0; i < status.length; i++) { const stat = status[i]; - output.push([stat.languageName, stat.locale, stat.translatorName, stat.percentDone + '%'].join(' | ')); + const flagUrl = 'https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/' + countryCodeOnly(stat.locale).toLowerCase() + '.png'; + output.push(['![](' + flagUrl + ')', stat.languageName, stat.locale, stat.translatorName, stat.percentDone + '%'].join(' | ')); } return output.join('\n'); } @@ -156,7 +157,8 @@ async function updateReadmeWithStats(stats) { mdTable = mdTableMarkerOpen + mdTable + mdTableMarkerClose; let content = await fs.readFile(rootDir + '/README.md', 'utf-8'); - const regex = new RegExp(mdTableMarkerOpen + '.*?' + mdTableMarkerClose); + // [^]* matches any character including new lines + const regex = new RegExp(mdTableMarkerOpen + '[^]*?' + mdTableMarkerClose); content = content.replace(regex, mdTable); await fs.writeFile(rootDir + '/README.md', content); } diff --git a/docs/index.html b/docs/index.html index 0f7da4970..b18e35a9d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -343,6 +343,7 @@ sudo ln -s ~/.joplin-bin/bin/joplin /usr/bin/joplin + @@ -351,72 +352,84 @@ sudo ln -s ~/.joplin-bin/bin/joplin /usr/bin/joplin + - + + - + + + + + + + + + - + + - + +
  Language Code Last translator
Croatian hr_HRHrvoje Mandić trbuhom@net.hrHrvoje Mandić trbuhom@net.hr 72%
Deutsch de_DETobias Strobel git@strobeltobias.deTobias Strobel git@strobeltobias.de 92%
English en_GB 100%
Español es_ES Lucas Vieites 80%
Español (Costa Rica) es_CR 68%
Français fr_FR Laurent Cozic 100%
Italiano it_IT 76%
Nederlands nl_BE 90%
Português (Brasil) pt_BR 74%
Русский ru_RUArtyom Karlov artyom.karlov@gmail.comArtyom Karlov artyom.karlov@gmail.com 96%
中文 (简体) zh_CNRCJacH RCJacH@outlook.comRCJacH RCJacH@outlook.com 76%
日本語 ja_JP