Skip to content

Commit 9dcb6ef

Browse files
committed
scripts: Add script to merge translation messages
Since the other components can be scripted, we might as well add a wrapper script to merge new translation strings into PO files.
1 parent 8708bb6 commit 9dcb6ef

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

addons/block_code/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,8 @@ up to date.
9999
shell script.
100100

101101
* If the POT file has changed, the PO message files need to be updated. This
102-
can be done using the gettext `msgmerge` tool in the
103-
`addons/block_code/locale` directory:
104-
```
105-
for po in *.po; do
106-
msgmerge --update --backup=none "$po" godot_block_coding.pot
107-
done
108-
```
102+
can be done using the gettext `msgmerge` tool with the
103+
`scripts/merge-messages.sh` shell script.
109104

110105
[pot-generation]: https://docs.godotengine.org/en/stable/tutorials/i18n/localization_using_gettext.html#automatic-generation-using-the-editor
111106

scripts/merge-messages.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
# Merge new strings from POT file into message catalogs.
4+
set -e
5+
6+
SCRIPTDIR=$(dirname "$0")
7+
PROJDIR=$(dirname "$SCRIPTDIR")
8+
LOCALEDIR="$PROJDIR/addons/block_code/locale"
9+
POT="$LOCALEDIR/godot_block_coding.pot"
10+
11+
for po in "$LOCALEDIR"/*.po; do
12+
echo -n "$po"
13+
msgmerge --update --backup=none "$po" "$POT"
14+
done

0 commit comments

Comments
 (0)