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