-
Notifications
You must be signed in to change notification settings - Fork 1
/
rebuild_i18n
executable file
·59 lines (46 loc) · 2.03 KB
/
rebuild_i18n
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
# Run this from the base of an opencore source dir.
if [ ! -d opencore/locales ]; then
echo "Must be run from the root of an opencore source tree"
exit 1
fi
rm ./rebuild_i18n.log
LOCALES=opencore/locales
POTFILE=$LOCALES/opencore.pot
MANUALPOT=$LOCALES/manual.pot
echo Rebuilding POT file $POTFILE...
i18ndude rebuild-pot --pot $POTFILE --merge $MANUALPOT --create opencore . || exit 1
echo Removing fake AZ translation...
rm -f $LOCALES/az/LC_MESSAGES/opencore.po
for POFILE in `find $LOCALES -type f -name opencore.po`; do
echo Syncing messages to PO file $POFILE...
i18ndude sync --pot $POTFILE $POFILE || exit 1
done
echo Now would be a good time for you to edit any translation .po files
echo
echo Creating fake AZ translation for tests...
python opencore/locales/create-az.py || exit 1
echo Running msgfmt to ensure .mo files are compiled with no syntax issues
type msgfmt
if [ $? -ne 0 ]; then
echo Could not find msgfmt command. Try installing gnu gettext.
exit 1
else
for subdir in `find . -name LC_MESSAGES`; do
echo " running msgfmt -o $subdir/opencore.mo $subdir/opencore.po"
msgfmt -o $subdir/opencore.mo $subdir/opencore.po
done
fi
echo
echo Getting status of markup in page templates...
ERRORS=`find . -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-ERROR' | wc -l`
WARNINGS=`find . -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-WARN' | wc -l`
FATAL=`find . -name "*pt" | xargs i18ndude find-untranslated | grep -e '^-FATAL' | wc -l`
echo
echo "There are $ERRORS errors \(almost definitely missing i18n markup\)"
echo "There are $WARNINGS warnings \(possibly missing i18n markup\)"
echo "There are $FATAL fatal errors \(template could not be parsed, eg. if it\'s not html\)"
echo "For more details, run \'find . -name \"\*pt\" \| xargs i18ndude find-untranslated\' or"
echo "Look the rebuild i18n log generate for this script called \'rebuild_i18n.log\' on locales dir"
touch ./rebuild_i18n.log
find ./ -name "*pt" | xargs i18ndude find-untranslated > rebuild_i18n.log