-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_translations.sh
executable file
·50 lines (39 loc) · 1.03 KB
/
update_translations.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
40
41
42
43
44
45
46
47
#!/bin/bash
DIR="languages"
DOMAIN="wpclef"
POT="$DIR/$DOMAIN.pot"
SOURCES="*.php"
# Create template
echo "Creating POT"
rm -f $POT
xgettext --copyright-holder="Clef, Inc." \
--package-name="WPClef" \
--package-version="2.6.1" \
--msgid-bugs-address="[email protected]" \
--language=PHP \
--sort-output \
--keyword=__ \
--keyword=_e \
--from-code=UTF-8 \
--output=$POT \
--default-domain=$DOMAIN \
`find . -type f -name "*.php" | grep -v ./node_modules | grep -v ./build`
# Update language .po files
for FILE in languages/*.po
do
LANG=${FILE#languages\/clef\-}
LANG=${LANG%\.po}
echo "Updating language file for $LANG from $POT"
msgmerge --sort-output --update --backup=off $FILE $POT
done
# Sync with Transifex
tx push -s -t
tx pull -af
# Compile language .po files to .mo
for FILE in languages/*.po
do
LANG=${FILE#languages\/clef\-}
LANG=${LANG%\.po}
echo "Compiling $LANG.po to $LANG.mo"
msgfmt --check --verbose --output-file=languages/clef-$LANG.mo $FILE
done