blob: 181f3cba16da674a1b0ff39c4e172a50fb18ee19 [file] [log] [blame]
avm999639f77d0d2020-12-28 22:16:12 +01001#!/bin/bash
Adrià Vilanova Martínez73c01d42021-06-08 13:57:36 +02002#
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
avm999639f77d0d2020-12-28 22:16:12 +01009emptyTranslationFile="{}"
10
11# Download new translations
12if [ ! -f "crowdin.yml" ]; then
13 echo "Copy crowdin.template.yml to crowdin.yml and fill in the API token."
14fi
15
16crowdin download -c crowdin.yml
17
18cd ../../src/_locales
19
avm99963ac2dc4a2021-01-10 20:01:35 +010020# Delete empty translations
avm999639f77d0d2020-12-28 22:16:12 +010021for lang in *; do
avm99963ac2dc4a2021-01-10 20:01:35 +010022 if [[ "$lang" == "README.md" ]]; then
23 continue
24 fi
avm999639f77d0d2020-12-28 22:16:12 +010025 if [ "x$emptyTranslationFile" = "x$(cat $lang/messages.json)" ]; then
26 echo "$lang has an empty translation. Deleting folder..."
27 rm -rf $lang
avm99963ac2dc4a2021-01-10 20:01:35 +010028 else
29 git add $lang/messages.json
avm999639f77d0d2020-12-28 22:16:12 +010030 fi
31done
avm99963ac2dc4a2021-01-10 20:01:35 +010032
33# Commit new translations
34git commit -m "Updating i18n files from Crowdin"