mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-29 04:49:51 +00:00
feat(strings): create new script to auto translate all files (#992)
* feat(strings): create new script to auto translate all files * - Fix path issue in append_translation.sh - Document flow for using it - Reformat localization files --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
9afed201c6
commit
49e2e05a72
26 changed files with 11124 additions and 13642 deletions
23
scripts/append_translation.sh
Executable file
23
scripts/append_translation.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# to use on Mac first install the translation shell `brew install translate-shell`
|
||||
# then install the jq `brew install jq`
|
||||
# then run this file with the English key and value that you want to be translated
|
||||
# `./append_translation.sh "greetings" "Hello World!"`
|
||||
# if you get an error `command not found`
|
||||
# give the correct permissions to this file using `chmod 777 append_translation.sh`
|
||||
|
||||
langs=("ar" "bg" "cs" "de" "en" "es" "fr" "ha" "hi" "hr" "id" "it" "ja" "ko" "my" "nl" "pl" "pt" "ru" "th" "tr" "uk" "ur" "yo" "zh")
|
||||
|
||||
name=$1
|
||||
text=$2
|
||||
|
||||
for lang in "${langs[@]}"; do
|
||||
translation="$(trans en:$lang --brief "$text")"
|
||||
|
||||
# Use jq to add the new key-value pair to the JSON object
|
||||
jq_result=$(jq '. += { "'"$name"'": "'"$translation"'" }' ../res/values/strings_$lang.arb)
|
||||
|
||||
echo "$jq_result" > ../res/values/strings_$lang.arb
|
||||
echo 'Added { "'"$name"'": "'"$translation"'" } to '"strings_$lang.arb"''
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue