Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

[Translations] Add update script & example config #368

Merged
merged 4 commits into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,5 @@ testem.log
.DS_Store
Thumbs.db

# Crowdin Config
crowdin.yml
36 changes: 36 additions & 0 deletions contrib/update-translation
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

cd "$(dirname "$0")/.."
token=$CROWDIN_TOKEN

# make config if not exist
[ -f "crowdin.yml" ] || {
# make sure it exist
[ -z "$token" ] && {
echo "token not set"
return 1
}
sed "s/-TOKEN-/${token}/g" crowdin.example.yml >crowdin.yml
}

# crowdin actions ...
crowdin push
crowdin pull

# normalize locales
for i in $(ls translations/??_??.json); do
file_old=$i
file_new=$(echo "$file_old" | tr '[:upper:]' '[:lower:]')
[ "$file_old" == "$file_new" ] || {
cp -f "$file_old" "$file_new" && rm "$file_old"
}
done

# default strings
cp -f translations/de_de.json src/assets/defaultStrings.json
yarn prettier -w src/assets/defaultStrings.json

# git action only update existing ...
#git add -u translations/ src/assets/defaultStrings.json
#git commit -m 'TODO'
#git push
12 changes: 12 additions & 0 deletions crowdin.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"project_id": "444900"
"api_token": "-TOKEN-"

"base_path": "."
"preserve_hierarchy": false
files:
[
{
"source": "translations/en_us.json",
"translation": "translations/%locale_with_underscore%.json",
},
]
2 changes: 1 addition & 1 deletion translations/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"noPPhrase": "Ungültige P-Nummer",
"removePPhrase": "P-Satz entfernen",
"addPPhrase": "P-Satz hinzufügen",
"editingHint": "Zum Beabeiten auf Substanz klicken.",
"editingHint": "Zum Bearbeiten auf Substanz klicken.",
"ghsSymbolsAddOrRemoveInfo": "Zum Entfernen oder Hinzufügen auf das Symbol klicken",
"ghsSymbolsColorInfo": "grau: nicht gewählt / farbig: gewählt",
"addCustomSubstanceData": "Eigene Substanz hinzufügen",
Expand Down
2 changes: 1 addition & 1 deletion translations/hr_hr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "engleski",
"name": "Hrvatski",
"locale": "hr_hr",
"strings": {
"base": {
Expand Down