ci: Update the coverage report for i18n PRs (#2592)
Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
This commit is contained in:
parent
d3bebbc68d
commit
5d6590c200
46
.github/workflows/locales-coverage.yml
vendored
46
.github/workflows/locales-coverage.yml
vendored
@ -30,44 +30,18 @@ jobs:
|
||||
git commit -am "Auto commit: Calculate translation coverage"
|
||||
git push
|
||||
fi
|
||||
|
||||
- name: Find pull request number
|
||||
uses: jwalton/gh-find-current-pr@v1
|
||||
id: findPullRequestNumber
|
||||
with:
|
||||
github-token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
|
||||
|
||||
- name: Find Comment
|
||||
uses: peter-evans/find-comment@v1
|
||||
id: findComment
|
||||
with:
|
||||
token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
|
||||
issue-number: ${{ steps.findPullRequestNumber.outputs.pr }}
|
||||
comment-author: "kbariotis"
|
||||
body-includes: "Languages check"
|
||||
|
||||
- name: Construct comment body
|
||||
id: getCommentBody
|
||||
run: |
|
||||
body=$(npm run locales-coverage:comment)
|
||||
comment_body="${comment_body//'%'/'%25'}"
|
||||
comment_body="${comment_body//$'\n'/'%0A'}"
|
||||
comment_body="${comment_body//$'\r'/'%0D'}"
|
||||
echo ::set-output name=body::$comment_body
|
||||
body=$(npm run locales-coverage:description | grep '^[^>]')
|
||||
body="${body//'%'/'%25'}"
|
||||
body="${body//$'\n'/'%0A'}"
|
||||
body="${body//$'\r'/'%0D'}"
|
||||
echo ::set-output name=body::$body
|
||||
|
||||
- name: Create comment
|
||||
if: ${{ steps.findComment.outputs.comment-id == 0 }}
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
- name: Update description with coverage
|
||||
uses: kt3k/update-pr-description@v1.0.1
|
||||
with:
|
||||
token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
|
||||
issue-number: ${{ steps.findPullRequestNumber.outputs.pr }}
|
||||
body: ${{ steps.getCommentBody.outputs.body }}
|
||||
|
||||
- name: Update comment
|
||||
if: ${{ steps.findComment.outputs.comment-id != 0 }}
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
edit-mode: "replace"
|
||||
token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
|
||||
comment-id: ${{ steps.findComment.outputs.comment-id }}
|
||||
body: ${{ steps.getCommentBody.outputs.body }}
|
||||
pr_body: ${{ steps.getCommentBody.outputs.body }}
|
||||
pr_title: "chore: New Crowdin updates"
|
||||
github_token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
|
||||
|
@ -90,7 +90,7 @@
|
||||
"fix:other": "npm run prettier -- --write",
|
||||
"fix": "npm run fix:other && npm run fix:code",
|
||||
"locales-coverage": "node scripts/build-locales-coverage.js",
|
||||
"locales-coverage:comment": "node scripts/locales-coverage-comment.js",
|
||||
"locales-coverage:description": "node scripts/locales-coverage-description.js",
|
||||
"prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
|
||||
"start": "react-scripts start",
|
||||
"test:all": "npm run test:typecheck && npm run test:code && npm run test:other && npm run test:app -- --watchAll=false",
|
||||
|
@ -110,6 +110,8 @@ const coverages = Object.entries(rowData)
|
||||
.sort(([, a], [, b]) => b - a)
|
||||
.reduce((r, [k, v]) => ({ ...r, [k]: v }), {});
|
||||
|
||||
const boldIf = (text, condition) => (condition ? `**${text}**` : text);
|
||||
|
||||
const printHeader = () => {
|
||||
let result = "| | Flag | Locale | % |\n";
|
||||
result += "| --: | :--: | -- | --: |";
|
||||
@ -117,55 +119,38 @@ const printHeader = () => {
|
||||
};
|
||||
|
||||
const printRow = (id, locale, coverage) => {
|
||||
let result = `| ${id} | `;
|
||||
const isOver = coverage > THRESSHOLD;
|
||||
let result = `| ${boldIf(id, isOver)} | `;
|
||||
|
||||
result += `${locale in flags ? flags[locale] : ""} | `;
|
||||
|
||||
const language = locale in languages ? languages[locale] : locale;
|
||||
if (locale in crowdinMap && crowdinMap[locale]) {
|
||||
result += `[${language}](https://crowdin.com/translate/excalidraw/10/${crowdinMap[locale]}) | `;
|
||||
result += `[${boldIf(
|
||||
language,
|
||||
isOver,
|
||||
)}](https://crowdin.com/translate/excalidraw/10/${crowdinMap[locale]}) | `;
|
||||
} else {
|
||||
result += `${language} | `;
|
||||
result += `${boldIf(language, isOver)} | `;
|
||||
}
|
||||
result += `${coverage} |`;
|
||||
result += `${boldIf(coverage, isOver)} |`;
|
||||
return result;
|
||||
};
|
||||
|
||||
let passId = 1;
|
||||
let notPassId = 1;
|
||||
const over = [];
|
||||
const under = [];
|
||||
|
||||
console.info("## Languages check");
|
||||
console.info("\n\r");
|
||||
console.info(
|
||||
`Our translations for every languages should be at least **${THRESSHOLD}%** to appear on Excalidraw. Join our project in [Crowdin](https://crowdin.com/project/excalidraw) and help us translate it in your language. **Can't find your own?** Open an [issue](https://github.com/excalidraw/excalidraw/issues/new) and we'll add it to the list.`,
|
||||
);
|
||||
console.info("\n\r");
|
||||
console.info(printHeader());
|
||||
let index = 1;
|
||||
for (const coverage in coverages) {
|
||||
if (coverage === "en") {
|
||||
continue;
|
||||
}
|
||||
const per = coverages[coverage];
|
||||
|
||||
if (per > THRESSHOLD) {
|
||||
over.push(printRow(passId, coverage, per));
|
||||
passId++;
|
||||
} else {
|
||||
under.push(printRow(notPassId, coverage, per));
|
||||
notPassId++;
|
||||
}
|
||||
}
|
||||
|
||||
console.info("## Languages check");
|
||||
console.info("");
|
||||
console.info(
|
||||
`Our translations for every languages should be at least **${THRESSHOLD}%** to appear on Excalidraw. Join our project in [Crowdin](https://crowdin.com/project/excalidraw) and help us translate it in your language.`,
|
||||
);
|
||||
console.info("");
|
||||
console.info("### Languages over the threshold");
|
||||
console.info("");
|
||||
console.info(printHeader());
|
||||
for (const row of over) {
|
||||
console.info(row);
|
||||
}
|
||||
console.info("");
|
||||
console.info("### Languages below the threshold");
|
||||
console.info("");
|
||||
console.info(printHeader());
|
||||
for (const row of under) {
|
||||
console.info(row);
|
||||
console.info(printRow(index, coverage, coverages[coverage]));
|
||||
index++;
|
||||
}
|
||||
console.info("\n\r");
|
||||
console.info("\\* Languages in **bold** are going to appear on production.");
|
@ -81,7 +81,7 @@
|
||||
"addToLibrary": "Προσθήκη στη βιβλιοθήκη",
|
||||
"removeFromLibrary": "Αφαίρεση από τη βιβλιοθήκη",
|
||||
"libraryLoadingMessage": "Φόρτωση βιβλιοθήκης...",
|
||||
"libraries": "",
|
||||
"libraries": "Άλλες βιβλιοθήκες",
|
||||
"loadingScene": "Φόρτωση σκηνής...",
|
||||
"align": "Στοίχιση",
|
||||
"alignTop": "Στοίχιση πάνω",
|
||||
@ -221,8 +221,8 @@
|
||||
},
|
||||
"stats": {
|
||||
"angle": "Γωνία",
|
||||
"element": "",
|
||||
"elements": "",
|
||||
"element": "Στοιχείο",
|
||||
"elements": "Στοιχεία",
|
||||
"height": "Ύψος",
|
||||
"scene": "",
|
||||
"selected": "Επιλεγμένα",
|
||||
|
@ -4,7 +4,7 @@
|
||||
"selectAll": "Tout sélectionner",
|
||||
"multiSelect": "Ajouter l'élément à la sélection",
|
||||
"moveCanvas": "Déplacer le canvas",
|
||||
"cut": "",
|
||||
"cut": "Couper",
|
||||
"copy": "Copier",
|
||||
"copyAsPng": "Copier dans le presse-papier en PNG",
|
||||
"copyAsSvg": "Copier dans le presse-papier en SVG",
|
||||
@ -29,11 +29,11 @@
|
||||
"edges": "Angles",
|
||||
"sharp": "Aigu",
|
||||
"round": "Rond",
|
||||
"arrowheads": "Pointes de flèche",
|
||||
"arrowheads": "Extrémités de ligne",
|
||||
"arrowhead_none": "Aucun",
|
||||
"arrowhead_arrow": "Flèche",
|
||||
"arrowhead_bar": "",
|
||||
"arrowhead_dot": "",
|
||||
"arrowhead_bar": "Barre",
|
||||
"arrowhead_dot": "Point",
|
||||
"fontSize": "Taille de la police",
|
||||
"fontFamily": "Police",
|
||||
"onlySelected": "Uniquement la sélection",
|
||||
@ -213,7 +213,7 @@
|
||||
"textNewLine": "Ajouter une nouvelle ligne (texte)",
|
||||
"textFinish": "Terminer l'édition (texte)",
|
||||
"zoomToFit": "Zoomer pour visualiser tous les éléments",
|
||||
"zoomToSelection": "",
|
||||
"zoomToSelection": "Zoom sur la sélection",
|
||||
"preventBinding": "Empêcher la liaison de la flèche"
|
||||
},
|
||||
"encrypted": {
|
||||
|
@ -3,12 +3,12 @@
|
||||
"bg-BG": 61,
|
||||
"ca-ES": 81,
|
||||
"de-DE": 99,
|
||||
"el-GR": 93,
|
||||
"el-GR": 95,
|
||||
"en": 100,
|
||||
"es-ES": 81,
|
||||
"fa-IR": 89,
|
||||
"fi-FI": 100,
|
||||
"fr-FR": 98,
|
||||
"fr-FR": 100,
|
||||
"he-IL": 69,
|
||||
"hi-IN": 82,
|
||||
"hu-HU": 44,
|
||||
@ -23,8 +23,8 @@
|
||||
"pl-PL": 79,
|
||||
"pt-PT": 83,
|
||||
"ro-RO": 100,
|
||||
"ru-RU": 77,
|
||||
"sk-SK": 99,
|
||||
"ru-RU": 81,
|
||||
"sk-SK": 100,
|
||||
"sv-SE": 100,
|
||||
"tr-TR": 81,
|
||||
"uk-UA": 98,
|
||||
|
@ -31,9 +31,9 @@
|
||||
"round": "Скругленные",
|
||||
"arrowheads": "",
|
||||
"arrowhead_none": "",
|
||||
"arrowhead_arrow": "",
|
||||
"arrowhead_arrow": "Cтрелка",
|
||||
"arrowhead_bar": "",
|
||||
"arrowhead_dot": "",
|
||||
"arrowhead_dot": "Точка",
|
||||
"fontSize": "Размер шрифта",
|
||||
"fontFamily": "Семейство шрифтов",
|
||||
"onlySelected": "Только выбранные",
|
||||
@ -220,15 +220,15 @@
|
||||
"tooltip": ""
|
||||
},
|
||||
"stats": {
|
||||
"angle": "",
|
||||
"element": "",
|
||||
"elements": "",
|
||||
"height": "",
|
||||
"angle": "Угол",
|
||||
"element": "Элемент",
|
||||
"elements": "Элементы",
|
||||
"height": "Высота",
|
||||
"scene": "",
|
||||
"selected": "",
|
||||
"storage": "",
|
||||
"title": "",
|
||||
"total": "",
|
||||
"width": ""
|
||||
"width": "Ширина"
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@
|
||||
"textNewLine": "Vložiť nový riadok (text)",
|
||||
"textFinish": "Ukončenie editovania (text)",
|
||||
"zoomToFit": "Priblížiť aby boli zahrnuté všetky prvky",
|
||||
"zoomToSelection": "",
|
||||
"zoomToSelection": "Priblížiť na výber",
|
||||
"preventBinding": "Zakázať pripájanie šípky"
|
||||
},
|
||||
"encrypted": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user