Skip to content

Commit 2590dc5

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 838ef1c commit 2590dc5

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
@@ -97,13 +97,8 @@ up to date.
9797
shell script.
9898

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

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

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)