ソースを参照

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,44 +30,18 @@ jobs:
30 30
             git commit -am "Auto commit: Calculate translation coverage"
31 31
             git push
32 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 33
       - name: Construct comment body
50 34
         id: getCommentBody
51 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 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,7 +90,7 @@
90 90
     "fix:other": "npm run prettier -- --write",
91 91
     "fix": "npm run fix:other && npm run fix:code",
92 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 94
     "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
95 95
     "start": "react-scripts start",
96 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,6 +110,8 @@ const coverages = Object.entries(rowData)
110 110
   .sort(([, a], [, b]) => b - a)
111 111
   .reduce((r, [k, v]) => ({ ...r, [k]: v }), {});
112 112
 
113
+const boldIf = (text, condition) => (condition ? `**${text}**` : text);
114
+
113 115
 const printHeader = () => {
114 116
   let result = "| | Flag | Locale | % |\n";
115 117
   result += "| --: | :--: | -- | --: |";
@@ -117,55 +119,38 @@ const printHeader = () => {
117 119
 };
118 120
 
119 121
 const printRow = (id, locale, coverage) => {
120
-  let result = `| ${id} | `;
122
+  const isOver = coverage > THRESSHOLD;
123
+  let result = `| ${boldIf(id, isOver)} | `;
121 124
 
122 125
   result += `${locale in flags ? flags[locale] : ""} | `;
126
+
123 127
   const language = locale in languages ? languages[locale] : locale;
124 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 133
   } else {
127
-    result += `${language} | `;
134
+    result += `${boldIf(language, isOver)} | `;
128 135
   }
129
-  result += `${coverage} |`;
136
+  result += `${boldIf(coverage, isOver)} |`;
130 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 140
 console.info("## Languages check");
154
-console.info("");
141
+console.info("\n\r");
155 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 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,7 +81,7 @@
81 81
     "addToLibrary": "Προσθήκη στη βιβλιοθήκη",
82 82
     "removeFromLibrary": "Αφαίρεση από τη βιβλιοθήκη",
83 83
     "libraryLoadingMessage": "Φόρτωση βιβλιοθήκης...",
84
-    "libraries": "",
84
+    "libraries": "Άλλες βιβλιοθήκες",
85 85
     "loadingScene": "Φόρτωση σκηνής...",
86 86
     "align": "Στοίχιση",
87 87
     "alignTop": "Στοίχιση πάνω",
@@ -221,8 +221,8 @@
221 221
   },
222 222
   "stats": {
223 223
     "angle": "Γωνία",
224
-    "element": "",
225
-    "elements": "",
224
+    "element": "Στοιχείο",
225
+    "elements": "Στοιχεία",
226 226
     "height": "Ύψος",
227 227
     "scene": "",
228 228
     "selected": "Επιλεγμένα",

+ 5
- 5
src/locales/fr-FR.json ファイルの表示

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

+ 4
- 4
src/locales/percentages.json ファイルの表示

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

+ 7
- 7
src/locales/ru-RU.json ファイルの表示

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

+ 1
- 1
src/locales/sk-SK.json ファイルの表示

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

読み込み中…
キャンセル
保存