File tree Expand file tree Collapse file tree 7 files changed +116
-9
lines changed Expand file tree Collapse file tree 7 files changed +116
-9
lines changed Original file line number Diff line number Diff line change @@ -90,21 +90,20 @@ up to date.
90
90
* If files are added or removed, the list of translatable files needs to be
91
91
updated. This can be done by using the ** Add** dialog in the [ POT
92
92
Generation] [ pot-generation ] tab. Or you can use the ** Project → Tools →
93
- Update BlockCode translated files** menu item in the editor.
93
+ Update BlockCode translated files** menu item in the editor. From the command
94
+ line, the POT file can be regenerated with the ` scripts/update-pot-files.sh `
95
+ shell script.
94
96
95
97
* If translatable strings have changed, the POT file needs to be updated. This
96
98
can be done by using the ** Generate POT** dialog in the [ POT
97
99
Generation] [ pot-generation ] tab. Or you can use the ** Project → Tools →
98
- Regenerate BlockCode POT file** menu item in the editor.
100
+ Regenerate BlockCode POT file** menu item in the editor. From the command
101
+ line, the POT file can be regenerated with the ` scripts/regenerate-pot.sh `
102
+ shell script.
99
103
100
104
* If the POT file has changed, the PO message files need to be updated. This
101
- can be done using the gettext ` msgmerge ` tool in the
102
- ` addons/block_code/locale ` directory:
103
- ```
104
- for po in *.po; do
105
- msgmerge --update --backup=none "$po" godot_block_coding.pot
106
- done
107
- ```
105
+ can be done using the gettext ` msgmerge ` tool with the
106
+ ` scripts/merge-messages.sh ` shell script.
108
107
109
108
[ pot-generation ] : https://docs.godotengine.org/en/stable/tutorials/i18n/localization_using_gettext.html#automatic-generation-using-the-editor
110
109
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Wrapper script to try to execute the Godot binary.
4
+ set -e
5
+
6
+ get_godot_bin () {
7
+ # GODOT environment variable preferred.
8
+ if [ -n " $GODOT " ]; then
9
+ echo " $GODOT "
10
+ return 0
11
+ fi
12
+
13
+ # godot in PATH.
14
+ if type -p godot > /dev/null; then
15
+ echo godot
16
+ return 0
17
+ fi
18
+
19
+ # Flatpak Godot with <installation>/exports/bin in PATH.
20
+ if type -p org.godotengine.Godot > /dev/null; then
21
+ echo org.godotengine.Godot
22
+ return 0
23
+ fi
24
+
25
+ # Flatpak Godot without <installation>/exports/bin in PATH.
26
+ if flatpak info org.godotengine.Godot & > /dev/null; then
27
+ echo " flatpak run org.godotengine.Godot"
28
+ return 0
29
+ fi
30
+
31
+ echo " error: Could not find godot executable, set GODOT environment variable" >&2
32
+ return 1
33
+ }
34
+
35
+ godot_bin=$( get_godot_bin)
36
+ exec $godot_bin " $@ "
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
1
+ ## BlockCode POT regeneration script
2
+ ##
3
+ ## Use this on the Godot command line with the --script option. This depends on
4
+ ## the Godot editor, so the --editor option is also required.
5
+ extends SceneTree
6
+
7
+ const TxUtils := preload ("res://addons/block_code/translation/utils.gd" )
8
+
9
+
10
+ # Everything happens in _process to ensure the editor is fully initialized.
11
+ func _process (_delta ):
12
+ if Engine .is_editor_hint ():
13
+ TxUtils .regenerate_pot_file ()
14
+ else :
15
+ push_error ("%s can only be run with --editor" % get_script ().resource_path )
16
+
17
+ # Stop processing the main loop.
18
+ return true
19
+
20
+
21
+ # The editor won't be shut down in the normal way, which will cause a bunch of
22
+ # leaks. There's nothing we can do about that and we don't care about them,
23
+ # anyways. Let the user following along know this is OK.
24
+ func _finalize ():
25
+ print_rich ("[b]%s causes Godot to leak resources. Ignore the warnings and errors![/b]" % get_script ().resource_path .get_file ())
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Wrapper script to try to execute the regenerate-pot.gd main loop script.
4
+ set -e
5
+
6
+ SCRIPTDIR=$( dirname " $0 " )
7
+ PROJDIR=$( dirname " $SCRIPTDIR " )
8
+ GODOT_SH=" $SCRIPTDIR /godot.sh"
9
+ SCRIPT=" $SCRIPTDIR /regenerate-pot.gd"
10
+
11
+ exec " $GODOT_SH " --path " $PROJDIR " --headless --editor --script " $SCRIPT "
Original file line number Diff line number Diff line change
1
+ ## BlockCode update translated files script
2
+ ##
3
+ ## Use this on the Godot command line with the --script option.
4
+ extends SceneTree
5
+
6
+ const TxUtils := preload ("res://addons/block_code/translation/utils.gd" )
7
+
8
+
9
+ func _init ():
10
+ TxUtils .update_pot_files ()
11
+ quit ()
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Wrapper script to try to execute the update-pot-files.gd main loop script.
4
+ set -e
5
+
6
+ SCRIPTDIR=$( dirname " $0 " )
7
+ PROJDIR=$( dirname " $SCRIPTDIR " )
8
+ GODOT_SH=" $SCRIPTDIR /godot.sh"
9
+ SCRIPT=" $SCRIPTDIR /update-pot-files.gd"
10
+
11
+ exec " $GODOT_SH " --path " $PROJDIR " --headless --script " $SCRIPT "
You can’t perform that action at this time.
0 commit comments