forked from uyuni-project/uyuni-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_strings
executable file
·38 lines (35 loc) · 1.2 KB
/
extract_strings
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
#!/bin/sh
#
# SPDX-FileCopyrightText: 2024 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
for MODULE in mgrctl mgradm mgrpxy shared; do
# Generate the pot file
echo "Generate locale/${MODULE}/${MODULE}.pot"
find ${MODULE} -type f -not -name '*_test.go' -name '*.go' | sort | xargs xgettext --no-wrap --keyword="PL:1c,2" --keyword="NL:1,2" --keyword="L" --language=Javascript --from-code=UTF-8 -o locale/${MODULE}/${MODULE}.pot -
msguniq --no-wrap -o locale/${MODULE}/${MODULE}-uniq.pot locale/${MODULE}/${MODULE}.pot
mv locale/${MODULE}/${MODULE}-uniq.pot locale/${MODULE}/${MODULE}.pot
# Update the po files
for PO in locale/${MODULE}/*.po; do
echo -n "Update ${PO}"
if msgmerge --no-wrap --update ${PO} locale/${MODULE}/${MODULE}.pot;
then
if test -f ${PO}~; then
rm ${PO}~
fi
else
echo "msgmerge for ${PO} failed"
fi
done
done
# Commit the changes
for change in `git diff --numstat | awk '{print $1}'`; do
if [ $change -gt 1 ]; then
git add -u
git commit -m "update strings for translations"
exit
fi
done
git reset --hard