Add script to calculate percentage of translation (#1826)

* add script to calculate percentage of translation

* test translation change

* change translation

* test

* change translation

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* change translation

* test

* test

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* fix workflow

* test

* test again

* Calculate percentages of each translation file

* Calculate percentages of each translation file

* test

* refactor

* change build logic

* fix types, move English first

* docs added

* test translation file

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* Calculate percentages of each translation file

* let this be the final test please

* Calculate percentages of each translation file

* test

* test

* Test

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* test

* Calculate percentages of each translation file

* test

* Auto commit: Calculate translation coverage

* test

* test

* test

* test

* Auto commit: Calculate translation coverage

* test

* only on master

* test

* test

* Auto commit: Calculate translation coverage

* switch to master branch

Co-authored-by: i18n automation <runner@fv-az76.2iswp1o5zimezclxzdlwqia2gf.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az129.idlktykl4ure3gqe2lnji05orb.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az76.pjgcdo5npjpenpqz2nk0ztqvxd.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az33.senarqq4ucbulg04aytwntvgah.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az51.icvemaqob4xunfekbtdiz2tu2c.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az78.gikxu4m3dpiulftj3bftpuu3ee.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az121.cqdewbghluceforu5pkvpnveec.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az139.jsbds1i2htye3fh1bzwbe4ugmf.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az50.0bg2cysi0dkefjvuua0a0kbd1h.cx.internal.cloudapp.net>
Co-authored-by: i18n automation <runner@fv-az51.nhi3in4tbx4ehjtltcwuwbwsua.cx.internal.cloudapp.net>
This commit is contained in:
Kostas Bariotis 2020-06-30 19:28:19 +01:00 committed by GitHub
parent e23f7d37b6
commit 8c3549f336
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 112 additions and 8 deletions

View file

@ -1,9 +1,18 @@
import LanguageDetector from "i18next-browser-languagedetector";
import fallbackLanguageData from "./locales/en.json";
import percentages from "./locales/percentages.json";
export const languages = [
{ lng: "en", label: "English", data: "en.json" },
const COMPLETION_THRESHOLD_TO_EXCEED = 85;
interface Language {
lng: string;
label: string;
data: string;
rtl?: boolean;
}
const allLanguages: Language[] = [
{ lng: "bg-BG", label: "Български", data: "bg-BG.json" },
{ lng: "de-DE", label: "Deutsch", data: "de-DE.json" },
{ lng: "es-ES", label: "Español", data: "es-ES.json" },
@ -30,6 +39,18 @@ export const languages = [
{ lng: "he-IL", label: "עברית", data: "he-IL.json", rtl: true },
];
export const languages: Language[] = [
{ lng: "en", label: "English", data: "en.json" },
]
.concat(
allLanguages.sort((left, right) => (left.label > right.label ? 1 : -1)),
)
.filter(
(lang) =>
(percentages as Record<string, number>)[lang.lng] >
COMPLETION_THRESHOLD_TO_EXCEED,
);
let currentLanguage = languages[0];
let currentLanguageData = {};
const fallbackLanguage = languages[0];