avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | emptyTranslationFile="{}" |
| 3 | |
| 4 | # Download new translations |
| 5 | if [ ! -f "crowdin.yml" ]; then |
| 6 | echo "Copy crowdin.template.yml to crowdin.yml and fill in the API token." |
| 7 | fi |
| 8 | |
| 9 | crowdin download -c crowdin.yml |
| 10 | |
| 11 | cd ../../src/_locales |
| 12 | |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 13 | # Delete empty translations |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 14 | for lang in *; do |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 15 | if [[ "$lang" == "README.md" ]]; then |
| 16 | continue |
| 17 | fi |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 18 | if [ "x$emptyTranslationFile" = "x$(cat $lang/messages.json)" ]; then |
| 19 | echo "$lang has an empty translation. Deleting folder..." |
| 20 | rm -rf $lang |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 21 | else |
| 22 | git add $lang/messages.json |
avm99963 | 9f77d0d | 2020-12-28 22:16:12 +0100 | [diff] [blame] | 23 | fi |
| 24 | done |
avm99963 | ac2dc4a | 2021-01-10 20:01:35 +0100 | [diff] [blame] | 25 | |
| 26 | # Commit new translations |
| 27 | git commit -m "Updating i18n files from Crowdin" |