blob: 4d3108d8a0c7e0c7ccc2576c16d85f2f5173098d [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
Adrià Vilanova Martínez0fe9f7b2021-06-08 14:24:38 +020018# Generate i18n credits file
19go run generate-i18n-credits.go
Adrià Vilanova Martínez915e15a2022-05-27 19:14:25 +020020git add ../../src/options/i18n-credits.json5
avm999639f77d0d2020-12-28 22:16:12 +010021
avm99963ac2dc4a2021-01-10 20:01:35 +010022# Delete empty translations
Adrià Vilanova Martíneza197d862022-05-27 17:33:20 +020023cd ../../src/static/_locales
avm999639f77d0d2020-12-28 22:16:12 +010024for lang in *; do
avm99963ac2dc4a2021-01-10 20:01:35 +010025 if [[ "$lang" == "README.md" ]]; then
26 continue
27 fi
avm999639f77d0d2020-12-28 22:16:12 +010028 if [ "x$emptyTranslationFile" = "x$(cat $lang/messages.json)" ]; then
29 echo "$lang has an empty translation. Deleting folder..."
30 rm -rf $lang
avm99963ac2dc4a2021-01-10 20:01:35 +010031 else
32 git add $lang/messages.json
avm999639f77d0d2020-12-28 22:16:12 +010033 fi
34done
avm99963ac2dc4a2021-01-10 20:01:35 +010035
36# Commit new translations
37git commit -m "Updating i18n files from Crowdin"