-
Notifications
You must be signed in to change notification settings - Fork 148
/
compile_ts.sh
executable file
·39 lines (34 loc) · 1 KB
/
compile_ts.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
36
37
38
39
#!/bin/bash
script_dir="$(dirname "$(readlink -f "$0")")"
cd $script_dir
venv_activator=".venv/PINCE/bin/activate"
if [ -f "$venv_activator" ]; then
. "$venv_activator"
else
echo "ERROR: Virtual environment not found, please use install.sh to install PINCE first"
exit
fi
supported_locale_list=$(python3 -c "
import locale
print('\n'.join(value.split('.')[0] for value in locale.locale_alias.values()))
")
list_ts=$(find i18n/ts -maxdepth 1 -type f -name '*.ts')
# If there's a user parameter, create a new locale based on it
if [ -n "$1" ]; then
list_ts="$list_ts i18n/ts/$1.ts"
fi
for ts in $list_ts; do
# Check if the locale is valid
if echo "$supported_locale_list" | grep -q "$(basename "$ts" .ts)"; then
pylupdate6 GUI/*.ui GUI/Widgets/*/Form/*.ui tr/tr.py --no-obsolete --ts "$ts"
python3 fix_ts.py "$ts"
else
list_invalidts="$list_invalidts $ts"
fi
done
if [ -n "$list_invalidts" ]; then
echo
echo "ERROR: The following locales are invalid, please check:"
echo "$list_invalidts"
exit 1
fi