Skip to content

Commit

Permalink
regenerate_po.sh: Add --no-merge flag to skip doing msgmerge
Browse files Browse the repository at this point in the history
  • Loading branch information
dorkster committed Aug 5, 2018
1 parent 90cecb4 commit 0f4f710
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions mods/default/languages/regenerate_po.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
#!/bin/sh
# Run this script in the language directory to update the pot and all *.po files

DO_MERGE=true
for i in "$@"; do
if [ "$i" == "--no-merge" ]; then
DO_MERGE=false
fi
done

# For the engine
# To generate the appropriate .pot file, you need to run the following command from the languages directory:
if [ -e engine.pot ] ; then
xgettext --keyword=get -o engine.pot ../../../src/*.cpp
echo "Generating engine.pot"

# xgettext doesn't allow defining a charset, but we want UTF-8 across the board
sed -i "s/charset=CHARSET/charset=UTF-8/" engine.pot
xgettext --keyword=get -o engine.pot ../../../src/*.cpp

# To update existing .po files, you need to run the following command from the languages directory:
# msgmerge -U -N <name_of_.po_file> <name_of_.pot_file>
# xgettext doesn't allow defining a charset, but we want UTF-8 across the board
sed -i "s/charset=CHARSET/charset=UTF-8/" engine.pot

for f in $(ls engine.*.po) ; do
echo "Processing $f"
msgmerge -U -N $f engine.pot
done
if [ $DO_MERGE = true ]; then
# To update existing .po files, you need to run the following command from the languages directory:
# msgmerge -U -N <name_of_.po_file> <name_of_.pot_file>

for f in $(ls engine.*.po) ; do
echo "Processing $f"
msgmerge -U -N --backup=none $f engine.pot
done
fi
fi

if [ -e data.pot ] ; then
echo "Generating data.pot"

# For mods:
./xgettext.py

for f in $(ls data.*.po) ; do
echo "Processing $f"
msgmerge -U -N $f data.pot
done
if [ $DO_MERGE = true ]; then
for f in $(ls data.*.po) ; do
echo "Processing $f"
msgmerge -U -N --backup=none $f data.pot
done
fi
fi

0 comments on commit 0f4f710

Please sign in to comment.