Add xgettext wrapper script (#11)

This commit is contained in:
y5nw
2024-12-21 23:51:26 +01:00
committed by GitHub
parent 9313b7b796
commit c544b42c63
2 changed files with 20 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
# `luanti_xgettext`
This script is a simple wrapper around `xgettext` that additionally passes
Luanti-specific options. In particular, it lets `xgettext` recognize keywords
that are used for client-side translations in Luanti.
In addition to `core.translate` and `core.translate_n`, this script follows the
following convention:
* `S(str, ...)` is a wrapper for `core.translate(str, ...)`
* `PS(str, str_plural, n)` is a wrapper for `core.translate_n(str, str_plural, n, ...)`.
* `FS` and `FPS` are wrappers that additionally formspec-escape the result of `S` and `PS`, respectively.
* `NS` and `NFS` are similar to `S` and `FS`, respectively, but they do not translate the string and instead allow the string to be translated later.
Refer to https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html for further information on the usage of `xgettext`.
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
xgettext -L lua --from-code=utf-8 \
-kS -kNS -kFS -kNFS -kPS:1,2 -kFPS:1,2 \
-kcore.translate:1c,2 -kcore.translate_n:1c,2,3 \
"$@"