-
Notifications
You must be signed in to change notification settings - Fork 2
/
convert-json.sh
executable file
·35 lines (29 loc) · 1.01 KB
/
convert-json.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -e
source utils.sh
app=${1:-"probe-mobile"}
validate_app_param $app
source supported_languages_mobile.sh $app
echo "$(basename "$0") : Supported languages ${SUPPORTED_LANGUAGES[*]}"
for dir in ${app}/*/;do
echo "$(basename "$0") : Converting $dir"
if [[ $app == "probe-mobile" ]]; then
python json-to-strings.py \
--json ${dir}strings.json \
--strings ${dir}Localizable.strings
python json-to-android-xml.py \
--json ${dir}strings.json \
--xml ${dir}strings.xml
fi
if [[ $app == "news-media-scan" ]]; then
language_code=$(basename $dir)
base_translation="probe-mobile/${language_code}/strings.json"
echo "$(basename "$0") : Base translation $base_translation"
if [ -f "$base_translation" ]; then
python json-to-nms-android-xml.py \
--json ${dir}strings.json \
--xml ${dir}strings.xml \
--base "${base_translation}"
fi
fi
done