浏览代码

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

Co-authored-by: Kostas Bariotis <konmpar@gmail.com>
vanilla_orig
Lipis 4 年前
父节点
当前提交
5d6590c200
没有帐户链接到提交者的电子邮件

+ 11
- 37
.github/workflows/locales-coverage.yml 查看文件

30
             git commit -am "Auto commit: Calculate translation coverage"
30
             git commit -am "Auto commit: Calculate translation coverage"
31
             git push
31
             git push
32
           fi
32
           fi
33
-
34
-      - name: Find pull request number
35
-        uses: jwalton/gh-find-current-pr@v1
36
-        id: findPullRequestNumber
37
-        with:
38
-          github-token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
39
-
40
-      - name: Find Comment
41
-        uses: peter-evans/find-comment@v1
42
-        id: findComment
43
-        with:
44
-          token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
45
-          issue-number: ${{ steps.findPullRequestNumber.outputs.pr }}
46
-          comment-author: "kbariotis"
47
-          body-includes: "Languages check"
48
-
49
       - name: Construct comment body
33
       - name: Construct comment body
50
         id: getCommentBody
34
         id: getCommentBody
51
         run: |
35
         run: |
52
-          body=$(npm run locales-coverage:comment)
53
-          comment_body="${comment_body//'%'/'%25'}"
54
-          comment_body="${comment_body//$'\n'/'%0A'}"
55
-          comment_body="${comment_body//$'\r'/'%0D'}"
56
-          echo ::set-output name=body::$comment_body
57
-
58
-      - name: Create comment
59
-        if: ${{ steps.findComment.outputs.comment-id == 0 }}
60
-        uses: peter-evans/create-or-update-comment@v1
36
+          body=$(npm run locales-coverage:description | grep '^[^>]')
37
+          body="${body//'%'/'%25'}"
38
+          body="${body//$'\n'/'%0A'}"
39
+          body="${body//$'\r'/'%0D'}"
40
+          echo ::set-output name=body::$body
41
+
42
+      - name: Update description with coverage
43
+        uses: kt3k/update-pr-description@v1.0.1
61
         with:
44
         with:
62
-          token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
63
-          issue-number: ${{ steps.findPullRequestNumber.outputs.pr }}
64
-          body: ${{ steps.getCommentBody.outputs.body }}
65
-
66
-      - name: Update comment
67
-        if: ${{ steps.findComment.outputs.comment-id != 0 }}
68
-        uses: peter-evans/create-or-update-comment@v1
69
-        with:
70
-          edit-mode: "replace"
71
-          token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
72
-          comment-id: ${{ steps.findComment.outputs.comment-id }}
73
-          body: ${{ steps.getCommentBody.outputs.body }}
45
+          pr_body: ${{ steps.getCommentBody.outputs.body }}
46
+          pr_title: "chore: New Crowdin updates"
47
+          github_token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}

+ 1
- 1
package.json 查看文件

90
     "fix:other": "npm run prettier -- --write",
90
     "fix:other": "npm run prettier -- --write",
91
     "fix": "npm run fix:other && npm run fix:code",
91
     "fix": "npm run fix:other && npm run fix:code",
92
     "locales-coverage": "node scripts/build-locales-coverage.js",
92
     "locales-coverage": "node scripts/build-locales-coverage.js",
93
-    "locales-coverage:comment": "node scripts/locales-coverage-comment.js",
93
+    "locales-coverage:description": "node scripts/locales-coverage-description.js",
94
     "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
94
     "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
95
     "start": "react-scripts start",
95
     "start": "react-scripts start",
96
     "test:all": "npm run test:typecheck && npm run test:code && npm run test:other && npm run test:app -- --watchAll=false",
96
     "test:all": "npm run test:typecheck && npm run test:code && npm run test:other && npm run test:app -- --watchAll=false",

scripts/locales-coverage-comment.js → scripts/locales-coverage-description.js 查看文件

110
   .sort(([, a], [, b]) => b - a)
110
   .sort(([, a], [, b]) => b - a)
111
   .reduce((r, [k, v]) => ({ ...r, [k]: v }), {});
111
   .reduce((r, [k, v]) => ({ ...r, [k]: v }), {});
112
 
112
 
113
+const boldIf = (text, condition) => (condition ? `**${text}**` : text);
114
+
113
 const printHeader = () => {
115
 const printHeader = () => {
114
   let result = "| | Flag | Locale | % |\n";
116
   let result = "| | Flag | Locale | % |\n";
115
   result += "| --: | :--: | -- | --: |";
117
   result += "| --: | :--: | -- | --: |";
117
 };
119
 };
118
 
120
 
119
 const printRow = (id, locale, coverage) => {
121
 const printRow = (id, locale, coverage) => {
120
-  let result = `| ${id} | `;
122
+  const isOver = coverage > THRESSHOLD;
123
+  let result = `| ${boldIf(id, isOver)} | `;
121
 
124
 
122
   result += `${locale in flags ? flags[locale] : ""} | `;
125
   result += `${locale in flags ? flags[locale] : ""} | `;
126
+
123
   const language = locale in languages ? languages[locale] : locale;
127
   const language = locale in languages ? languages[locale] : locale;
124
   if (locale in crowdinMap && crowdinMap[locale]) {
128
   if (locale in crowdinMap && crowdinMap[locale]) {
125
-    result += `[${language}](https://crowdin.com/translate/excalidraw/10/${crowdinMap[locale]}) | `;
129
+    result += `[${boldIf(
130
+      language,
131
+      isOver,
132
+    )}](https://crowdin.com/translate/excalidraw/10/${crowdinMap[locale]}) | `;
126
   } else {
133
   } else {
127
-    result += `${language} | `;
134
+    result += `${boldIf(language, isOver)} | `;
128
   }
135
   }
129
-  result += `${coverage} |`;
136
+  result += `${boldIf(coverage, isOver)} |`;
130
   return result;
137
   return result;
131
 };
138
 };
132
 
139
 
133
-let passId = 1;
134
-let notPassId = 1;
135
-const over = [];
136
-const under = [];
137
-
138
-for (const coverage in coverages) {
139
-  if (coverage === "en") {
140
-    continue;
141
-  }
142
-  const per = coverages[coverage];
143
-
144
-  if (per > THRESSHOLD) {
145
-    over.push(printRow(passId, coverage, per));
146
-    passId++;
147
-  } else {
148
-    under.push(printRow(notPassId, coverage, per));
149
-    notPassId++;
150
-  }
151
-}
152
-
153
 console.info("## Languages check");
140
 console.info("## Languages check");
154
-console.info("");
141
+console.info("\n\r");
155
 console.info(
142
 console.info(
156
-  `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.`,
143
+  `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.`,
157
 );
144
 );
158
-console.info("");
159
-console.info("### Languages over the threshold");
160
-console.info("");
161
-console.info(printHeader());
162
-for (const row of over) {
163
-  console.info(row);
164
-}
165
-console.info("");
166
-console.info("### Languages below the threshold");
167
-console.info("");
145
+console.info("\n\r");
168
 console.info(printHeader());
146
 console.info(printHeader());
169
-for (const row of under) {
170
-  console.info(row);
147
+let index = 1;
148
+for (const coverage in coverages) {
149
+  if (coverage === "en") {
150
+    continue;
151
+  }
152
+  console.info(printRow(index, coverage, coverages[coverage]));
153
+  index++;
171
 }
154
 }
155
+console.info("\n\r");
156
+console.info("\\* Languages in **bold** are going to appear on production.");

+ 3
- 3
src/locales/el-GR.json 查看文件

81
     "addToLibrary": "Προσθήκη στη βιβλιοθήκη",
81
     "addToLibrary": "Προσθήκη στη βιβλιοθήκη",
82
     "removeFromLibrary": "Αφαίρεση από τη βιβλιοθήκη",
82
     "removeFromLibrary": "Αφαίρεση από τη βιβλιοθήκη",
83
     "libraryLoadingMessage": "Φόρτωση βιβλιοθήκης...",
83
     "libraryLoadingMessage": "Φόρτωση βιβλιοθήκης...",
84
-    "libraries": "",
84
+    "libraries": "Άλλες βιβλιοθήκες",
85
     "loadingScene": "Φόρτωση σκηνής...",
85
     "loadingScene": "Φόρτωση σκηνής...",
86
     "align": "Στοίχιση",
86
     "align": "Στοίχιση",
87
     "alignTop": "Στοίχιση πάνω",
87
     "alignTop": "Στοίχιση πάνω",
221
   },
221
   },
222
   "stats": {
222
   "stats": {
223
     "angle": "Γωνία",
223
     "angle": "Γωνία",
224
-    "element": "",
225
-    "elements": "",
224
+    "element": "Στοιχείο",
225
+    "elements": "Στοιχεία",
226
     "height": "Ύψος",
226
     "height": "Ύψος",
227
     "scene": "",
227
     "scene": "",
228
     "selected": "Επιλεγμένα",
228
     "selected": "Επιλεγμένα",

+ 5
- 5
src/locales/fr-FR.json 查看文件

4
     "selectAll": "Tout sélectionner",
4
     "selectAll": "Tout sélectionner",
5
     "multiSelect": "Ajouter l'élément à la sélection",
5
     "multiSelect": "Ajouter l'élément à la sélection",
6
     "moveCanvas": "Déplacer le canvas",
6
     "moveCanvas": "Déplacer le canvas",
7
-    "cut": "",
7
+    "cut": "Couper",
8
     "copy": "Copier",
8
     "copy": "Copier",
9
     "copyAsPng": "Copier dans le presse-papier en PNG",
9
     "copyAsPng": "Copier dans le presse-papier en PNG",
10
     "copyAsSvg": "Copier dans le presse-papier en SVG",
10
     "copyAsSvg": "Copier dans le presse-papier en SVG",
29
     "edges": "Angles",
29
     "edges": "Angles",
30
     "sharp": "Aigu",
30
     "sharp": "Aigu",
31
     "round": "Rond",
31
     "round": "Rond",
32
-    "arrowheads": "Pointes de flèche",
32
+    "arrowheads": "Extrémités de ligne",
33
     "arrowhead_none": "Aucun",
33
     "arrowhead_none": "Aucun",
34
     "arrowhead_arrow": "Flèche",
34
     "arrowhead_arrow": "Flèche",
35
-    "arrowhead_bar": "",
36
-    "arrowhead_dot": "",
35
+    "arrowhead_bar": "Barre",
36
+    "arrowhead_dot": "Point",
37
     "fontSize": "Taille de la police",
37
     "fontSize": "Taille de la police",
38
     "fontFamily": "Police",
38
     "fontFamily": "Police",
39
     "onlySelected": "Uniquement la sélection",
39
     "onlySelected": "Uniquement la sélection",
213
     "textNewLine": "Ajouter une nouvelle ligne (texte)",
213
     "textNewLine": "Ajouter une nouvelle ligne (texte)",
214
     "textFinish": "Terminer l'édition (texte)",
214
     "textFinish": "Terminer l'édition (texte)",
215
     "zoomToFit": "Zoomer pour visualiser tous les éléments",
215
     "zoomToFit": "Zoomer pour visualiser tous les éléments",
216
-    "zoomToSelection": "",
216
+    "zoomToSelection": "Zoom sur la sélection",
217
     "preventBinding": "Empêcher la liaison de la flèche"
217
     "preventBinding": "Empêcher la liaison de la flèche"
218
   },
218
   },
219
   "encrypted": {
219
   "encrypted": {

+ 4
- 4
src/locales/percentages.json 查看文件

3
   "bg-BG": 61,
3
   "bg-BG": 61,
4
   "ca-ES": 81,
4
   "ca-ES": 81,
5
   "de-DE": 99,
5
   "de-DE": 99,
6
-  "el-GR": 93,
6
+  "el-GR": 95,
7
   "en": 100,
7
   "en": 100,
8
   "es-ES": 81,
8
   "es-ES": 81,
9
   "fa-IR": 89,
9
   "fa-IR": 89,
10
   "fi-FI": 100,
10
   "fi-FI": 100,
11
-  "fr-FR": 98,
11
+  "fr-FR": 100,
12
   "he-IL": 69,
12
   "he-IL": 69,
13
   "hi-IN": 82,
13
   "hi-IN": 82,
14
   "hu-HU": 44,
14
   "hu-HU": 44,
23
   "pl-PL": 79,
23
   "pl-PL": 79,
24
   "pt-PT": 83,
24
   "pt-PT": 83,
25
   "ro-RO": 100,
25
   "ro-RO": 100,
26
-  "ru-RU": 77,
27
-  "sk-SK": 99,
26
+  "ru-RU": 81,
27
+  "sk-SK": 100,
28
   "sv-SE": 100,
28
   "sv-SE": 100,
29
   "tr-TR": 81,
29
   "tr-TR": 81,
30
   "uk-UA": 98,
30
   "uk-UA": 98,

+ 7
- 7
src/locales/ru-RU.json 查看文件

31
     "round": "Скругленные",
31
     "round": "Скругленные",
32
     "arrowheads": "",
32
     "arrowheads": "",
33
     "arrowhead_none": "",
33
     "arrowhead_none": "",
34
-    "arrowhead_arrow": "",
34
+    "arrowhead_arrow": "Cтрелка",
35
     "arrowhead_bar": "",
35
     "arrowhead_bar": "",
36
-    "arrowhead_dot": "",
36
+    "arrowhead_dot": "Точка",
37
     "fontSize": "Размер шрифта",
37
     "fontSize": "Размер шрифта",
38
     "fontFamily": "Семейство шрифтов",
38
     "fontFamily": "Семейство шрифтов",
39
     "onlySelected": "Только выбранные",
39
     "onlySelected": "Только выбранные",
220
     "tooltip": ""
220
     "tooltip": ""
221
   },
221
   },
222
   "stats": {
222
   "stats": {
223
-    "angle": "",
224
-    "element": "",
225
-    "elements": "",
226
-    "height": "",
223
+    "angle": "Угол",
224
+    "element": "Элемент",
225
+    "elements": "Элементы",
226
+    "height": "Высота",
227
     "scene": "",
227
     "scene": "",
228
     "selected": "",
228
     "selected": "",
229
     "storage": "",
229
     "storage": "",
230
     "title": "",
230
     "title": "",
231
     "total": "",
231
     "total": "",
232
-    "width": ""
232
+    "width": "Ширина"
233
   }
233
   }
234
 }
234
 }

+ 1
- 1
src/locales/sk-SK.json 查看文件

213
     "textNewLine": "Vložiť nový riadok (text)",
213
     "textNewLine": "Vložiť nový riadok (text)",
214
     "textFinish": "Ukončenie editovania (text)",
214
     "textFinish": "Ukončenie editovania (text)",
215
     "zoomToFit": "Priblížiť aby boli zahrnuté všetky prvky",
215
     "zoomToFit": "Priblížiť aby boli zahrnuté všetky prvky",
216
-    "zoomToSelection": "",
216
+    "zoomToSelection": "Priblížiť na výber",
217
     "preventBinding": "Zakázať pripájanie šípky"
217
     "preventBinding": "Zakázať pripájanie šípky"
218
   },
218
   },
219
   "encrypted": {
219
   "encrypted": {

正在加载...
取消
保存