Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

ci: Update the coverage report for i18n PRs (#2592)

Lipis5d6590c20089
diff --git a/.github/workflows/locales-coverage.yml b/.github/workflows/locales-coverage.yml
index a46dad1915..d391639e1b 100644
--- a/.github/workflows/locales-coverage.yml
+++ b/.github/workflows/locales-coverage.yml
@@ -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
-
- - name: Create comment
- if: ${{ steps.findComment.outputs.comment-id == 0 }}
- uses: peter-evans/create-or-update-comment@v1
+ 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: Update description with coverage
+ uses: kt3k/[email protected]
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 }}
diff --git a/package.json b/package.json
index 0bc35697d2..76995ce527 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/scripts/locales-coverage-comment.js b/scripts/locales-coverage-description.js
similarity index 79%
rename from scripts/locales-coverage-comment.js
rename to scripts/locales-coverage-description.js
index ae7d4a3ea1..3a8ea79519 100644
--- a/scripts/locales-coverage-comment.js
+++ b/scripts/locales-coverage-description.js
@@ -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 = [];
-
-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("\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.`,
+ `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("");
-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("\n\r");
console.info(printHeader());
-for (const row of under) {
- console.info(row);
+let index = 1;
+for (const coverage in coverages) {
+ if (coverage === "en") {
+ continue;
+ }
+ console.info(printRow(index, coverage, coverages[coverage]));
+ index++;
}
+console.info("\n\r");
+console.info("\\* Languages in **bold** are going to appear on production.");
diff --git a/src/locales/el-GR.json b/src/locales/el-GR.json
index 5a10b6bcd6..3a0894a127 100644
--- a/src/locales/el-GR.json
+++ b/src/locales/el-GR.json
@@ -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": "Επιλεγμένα",
diff --git a/src/locales/fr-FR.json b/src/locales/fr-FR.json
index fec6fa2975..b46fe31602 100644
--- a/src/locales/fr-FR.json
+++ b/src/locales/fr-FR.json
@@ -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": {
diff --git a/src/locales/percentages.json b/src/locales/percentages.json
index 2875cd58fa..253a489ac9 100644
--- a/src/locales/percentages.json
+++ b/src/locales/percentages.json
@@ -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,
diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json
index 8f91adc8f9..d51b074b8a 100644
--- a/src/locales/ru-RU.json
+++ b/src/locales/ru-RU.json
@@ -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": "Ширина"
}
}
diff --git a/src/locales/sk-SK.json b/src/locales/sk-SK.json
index 1163349df9..2cedc8b306 100644
--- a/src/locales/sk-SK.json
+++ b/src/locales/sk-SK.json
@@ -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": {