avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 1 | #!/bin/bash |
Adrià Vilanova Martínez | 73c01d4 | 2021-06-08 13:57:36 +0200 | [diff] [blame] | 2 | # |
| 3 | # Downloads updated translations from Crowdin and creates a new commit with the |
| 4 | # new updates. |
| 5 | # |
| 6 | # This commit should be uploaded afterwards for review with the |git review| |
| 7 | # command (take a look to check everything went well before uploading it). |
| 8 | |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 9 | emptyTranslationFile="{}" |
| 10 | |
| 11 | # Download new translations |
| 12 | if [ ! -f "crowdin.yml" ]; then |
| 13 | echo "Copy crowdin.template.yml to crowdin.yml and fill in the API token." |
| 14 | fi |
| 15 | |
| 16 | crowdin download -c crowdin.yml |
| 17 | |
Adrià Vilanova Martínez | 0fe9f7b | 2021-06-08 14:24:38 +0200 | [diff] [blame] | 18 | # Generate i18n credits file |
| 19 | go run generate-i18n-credits.go |
Adrià Vilanova Martínez | 915e15a | 2022-05-27 19:14:25 +0200 | [diff] [blame] | 20 | git add ../../src/options/i18n-credits.json5 |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 21 | |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 22 | # Delete empty translations |
Adrià Vilanova Martínez | a197d86 | 2022-05-27 17:33:20 +0200 | [diff] [blame] | 23 | cd ../../src/static/_locales |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 24 | for lang in *; do |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 25 | if [[ "$lang" == "README.md" ]]; then |
| 26 | continue |
| 27 | fi |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 28 | if [ "x$emptyTranslationFile" = "x$(cat $lang/messages.json)" ]; then |
| 29 | echo "$lang has an empty translation. Deleting folder..." |
| 30 | rm -rf $lang |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 31 | else |
| 32 | git add $lang/messages.json |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 33 | fi |
| 34 | done |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 35 | |
| 36 | # Commit new translations |
| 37 | git commit -m "Updating i18n files from Crowdin" |