mirror of
https://github.com/minetest-mods/intllib.git
synced 2025-06-28 14:16:05 +02:00
Add support for gettext message catalogs.
This commit is contained in:
33
tools/xgettext.bat
Normal file
33
tools/xgettext.bat
Normal file
@ -0,0 +1,33 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set me=%~n0
|
||||
|
||||
rem # Uncomment the following line if gettext is not in your PATH.
|
||||
rem # Value must be absolute and end in a backslash.
|
||||
rem set gtprefix=C:\path\to\gettext\bin\
|
||||
|
||||
if "%1" == "" (
|
||||
echo Usage: %me% FILE... 1>&2
|
||||
exit 1
|
||||
)
|
||||
|
||||
set xgettext=%gtprefix%xgettext.exe
|
||||
set msgmerge=%gtprefix%msgmerge.exe
|
||||
|
||||
md locale > nul 2>&1
|
||||
echo Generating template... 1>&2
|
||||
echo %xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
|
||||
%xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
|
||||
if %ERRORLEVEL% neq 0 goto done
|
||||
|
||||
cd locale
|
||||
|
||||
for %%f in (*.po) do (
|
||||
echo Updating %%f... 1>&2
|
||||
%msgmerge% --update %%f template.pot
|
||||
)
|
||||
|
||||
echo DONE! 1>&2
|
||||
|
||||
:done
|
23
tools/xgettext.sh
Executable file
23
tools/xgettext.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#! /bin/bash
|
||||
|
||||
me=$(basename "${BASH_SOURCE[0]}");
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Usage: $me FILE..." >&2;
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
mkdir -p locale;
|
||||
echo "Generating template..." >&2;
|
||||
xgettext --from-code=UTF-8 -kS -kNS:1,2 -k_ \
|
||||
-o locale/template.pot "$@" \
|
||||
|| exit;
|
||||
|
||||
cd locale;
|
||||
|
||||
for file in *.po; do
|
||||
echo "Updating $file..." >&2;
|
||||
msgmerge --update "$file" template.pot;
|
||||
done
|
||||
|
||||
echo "DONE!" >&2;
|
Reference in New Issue
Block a user