Skip to content

Commit 544d8bd

Browse files
author
Adam Litke
committed
build: Add gettext i18n support
Use the standard autotools gettext recipes to build our mo files. Rather than use pygettext to parse the html.tmpl files, I am using a simple shell snippet to extract the translatable strings and pass them straight to xgettext. In order to make sure the translations work when running from the source tree, the build creates a mo/ directory in $(topdir) and config.py has been adjusted to point to that. Signed-off-by: Adam Litke <[email protected]>
1 parent b868785 commit 544d8bd

16 files changed

+3099
-13
lines changed

ABOUT-NLS

+1,281
Large diffs are not rendered by default.

Makefile.am

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,20 @@
2020
# License along with this library; if not, write to the Free Software
2121
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2222

23-
SUBDIRS = src ui docs contrib tests
23+
SUBDIRS = src ui docs contrib tests po
2424

2525
ACLOCAL_AMFLAGS = --install -I m4
2626

2727
EXTRA_DIST = config.rpath
28+
29+
# Link built mo files in the source tree to enable use of translations from
30+
# within the source tree
31+
all-local:
32+
while read L && test -n "$$L"; do \
33+
dir=mo/$$L/LC_MESSAGES ; \
34+
$(MKDIR_P) $$dir ; \
35+
ln -sf ../../../po/$$L.gmo $$dir/kimchi.mo ; \
36+
done < po/LINGUAS
37+
38+
clean-local:
39+
rm -rf mo

configure.ac

+3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ AM_INIT_AUTOMAKE([-Wno-portability])
3939
AM_PATH_PYTHON([2.6])
4040
AC_PYTHON_MODULE([unittest])
4141
AC_SUBST([HAVE_PYMOD_UNITTEST])
42+
AM_GNU_GETTEXT([external])
43+
AM_GNU_GETTEXT_VERSION([0.10])
4244

4345
AC_CONFIG_FILES([
46+
po/Makefile.in
4447
Makefile
4548
docs/Makefile
4649
src/Makefile

po/LINGUAS

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
en_US
2+
pt_BR
3+
zh_CN

0 commit comments

Comments
 (0)