You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
name: i18n check consistency and notify on GitHub Issues
1
+
# -------------------------
2
+
# To add a new language, do the following:
3
+
# - add the 2-letter language code in matrix.language
4
+
# - add the flag and language name that you want to use at the beginning of the #check-consistency step
5
+
# -------------------------
6
+
name: i18n Consistency Check
2
7
3
8
on:
4
-
pull_request:
5
-
branches:
6
-
- master
7
-
paths:
8
-
- .github/workflows/i18n-consistency-check.yml
9
9
schedule:
10
-
- cron: '0 0 1 * *'
10
+
- cron: '0 0 1 * *'# run at midnight, on day 1 of the month
11
11
workflow_dispatch:
12
12
13
13
jobs:
@@ -17,82 +17,66 @@ jobs:
17
17
matrix:
18
18
language: [ja, zh]
19
19
steps:
20
-
- uses: actions/checkout@v2
20
+
- uses: actions/checkout@v3
21
21
with:
22
22
fetch-depth: '0'
23
-
- name: Check consistency
23
+
- name: Check consistency and create issue
24
24
id: check-consistency
25
25
run: |
26
-
# Set the issue header
27
-
issue="\
28
-
# i18n Contents Consistency Issue\\n\
29
-
\\n\
30
-
The following files may have consistency issues with the English version. Please check and update the files.\\n\
31
-
\\n\
32
-
This issue is created when there is an update to content/en. It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete.\\n"
33
-
34
-
for file in $(find patterns/2-structured -name '*.md'); do
35
-
36
-
# Get the translated file name and check if it exists
37
-
i18n_filename=$(echo "$file" | sed 's/patterns\/2-structured/translation\/${{matrix.language}}\/patterns/g')
26
+
# Declare the flags
27
+
declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese")
The following files may have consistency issues with the English version. Please check and update the files.
36
+
37
+
This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete.
38
+
EOM
39
+
40
+
# Loop through all files in the English directory
41
+
for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do
42
+
[[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26
43
+
i18n_filename=$(echo "$file" | sed "s/patterns\/\(2-structured\|3-validated\)/translation\/${{matrix.language}}\/patterns/g")
44
+
38
45
if [[ ! -e "$i18n_filename" ]]; then
39
-
continue
46
+
continue
40
47
fi
41
-
echo $file
42
-
echo $i18n_filename
43
-
# Loop through all the files in the English directory
44
-
# Get the last updated date of the original file and the translated file
issue+="- [Diff on GitHub](https://github.com/yuhattor/innersourcecommons.org/compare/$i18n_last_update_hash...$original_last_update_hash)\\n"
72
-
issue+="- Days since overdue updates: $days_since_overdue_updates days\\n"
73
-
issue+="\`\`\`diff\\n"
74
-
issue+="$result"
75
-
issue+="\\n\`\`\`\\n"
76
-
issue+="</details>\\n"
77
-
echo -e "$issue" >> issue.md
78
-
issue=""
66
+
For more information, please compare [the original file(en)](https://github.com/$GITHUB_REPOSITORY/blob/master/$file) with [the translated file](https://github.com/$GITHUB_REPOSITORY/blob/master/$i18n_filename). You can view [the differences](https://github.com/$GITHUB_REPOSITORY/compare/$i18n_last_update_hash...$original_last_update_hash) on GitHub. The number of days since overdue updates is **$days_since_overdue_updates** days.
0 commit comments