Permalink
Browse files

Update Makefile to support multiple languages

  • Loading branch information...
1 parent df02982 commit 99e4e97c6927a6d72e2c0940a51bd19bce8be327 @sebp committed Oct 7, 2012
Showing with 11 additions and 8 deletions.
  1. +10 −7 Makefile
  2. +1 −1 source/conf.py
View
17 Makefile
@@ -7,8 +7,10 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
DOCNAME = PythonGTK3Tutorial
-PODIR = translations/ja
-MODIR = source/locale/ja/LC_MESSAGES
+PODIR = translations
+LOCALEDIR = translations/locale
+
+LANGUAGES = ja
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -38,13 +40,14 @@ help:
clean:
-rm -rf $(BUILDDIR)/*
+ -rm -rf $(LOCALEDIR)
+getmo = $(LOCALEDIR)/$(2)/LC_MESSAGES/$(patsubst %.po,%.mo,$(notdir $(1)))
+genmo = $(shell msgfmt $(1) -o $(call getmo,$(1),$(2)))
+genlang = $(foreach po, $(wildcard $(1)/*.po), $(call genmo,$(po),$(2)))
updatepo:
- @for po in $(PODIR)/*.po; do \
- echo "Converting '$(MODIR)/`basename $$po .po`.mo' from '$$po'" ; \
- $(if test ! -d $(MODIR), mkdir -p $(MODIR)) ; \
- msgfmt $$po -o $(MODIR)/`basename $$po .po`.mo ; \
- done;
+ $(foreach lang, $(LANGUAGES), @mkdir -p $(LOCALEDIR)/$(lang)/LC_MESSAGES)
+ $(foreach lang, $(LANGUAGES), $(call genlang,$(PODIR)/$(lang),$(lang)))
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
View
2 source/conf.py
@@ -43,7 +43,7 @@
project = u'Python GTK+ 3 Tutorial'
copyright = u'GNU Free Documentation License 1.3'
-locale_dirs = ["./locale",]
+locale_dirs = ["../translations/locale",]
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

0 comments on commit 99e4e97

Please sign in to comment.