You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Resolves #1459: Make translation files smaller by not including untranslated strings. Also add percentage translated to config screen.
This commit is contained in:
@ -179,6 +179,7 @@ codeToCountry_["GB"] = "UK";
|
||||
codeToCountry_["US"] = "US";
|
||||
|
||||
let supportedLocales_ = null;
|
||||
let localeStats_ = null;
|
||||
|
||||
let loadedLocales_ = {};
|
||||
|
||||
@ -190,6 +191,11 @@ function defaultLocale() {
|
||||
return defaultLocale_;
|
||||
}
|
||||
|
||||
function localeStats() {
|
||||
if (!localeStats_) localeStats_ = require('../locales/index.js').stats;
|
||||
return localeStats_;
|
||||
}
|
||||
|
||||
function supportedLocales() {
|
||||
if (!supportedLocales_) supportedLocales_ = require('../locales/index.js').locales;
|
||||
|
||||
@ -201,12 +207,19 @@ function supportedLocales() {
|
||||
return output;
|
||||
}
|
||||
|
||||
function supportedLocalesToLanguages() {
|
||||
function supportedLocalesToLanguages(options = null) {
|
||||
if (!options) options = {};
|
||||
const stats = localeStats();
|
||||
const locales = supportedLocales();
|
||||
let output = {};
|
||||
for (let i = 0; i < locales.length; i++) {
|
||||
const locale = locales[i];
|
||||
output[locale] = countryDisplayName(locale);
|
||||
|
||||
const stat = stats[locale];
|
||||
if (options.includeStats && stat) {
|
||||
output[locale] += ' (' + stat.percentDone + '%)';
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user