aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile44
-rw-r--r--conf.py6
2 files changed, 34 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 87f21c5..c42af71 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,5 @@
# Minimal makefile for Sphinx documentation
#
-
# You can set these variables from the command line.
override LOCALE := $(or $(LOCALE),fr)
PUBHOST ?= club1.fr
@@ -13,39 +12,52 @@ override NOTFR =
endif
SPHINXLANG = -D language=$(LOCALE)
-SPHINXOPTS ?=
+SPHINXOPTS += -a
SPHINXBUILD ?= sphinx-build
-SPHINXLCMDS = html latexpdf man
-SPHINXCMDS = clean gettext
+SPHINXLCMDS = html dirhtml singlehtml epub latex latexpdf latexpdfja text man texinfo info
+SPHINXCMDS = pickle json htmlhelp changes xml pseudoxml linkcheck doctest coverage
SOURCEDIR = .
BUILDDIR = _build
+MDFILES = index.md $(shell find . -type f -name '*.md')
LOCALES = en
-LOCALESDIRS = $(LOCALES:%=locales/%)
+LOCALEFILES = $(LOCALES:%=locales/%/LC_MESSAGES/package.po)
+DIRS = locales
# Put it first so that "make" without argument is like "make help".
help:
$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O
-.PHONY: help locales publish Makefile $(SPHINXLCMDS) $(SPHINXCMDS)
+.PHONY: help clean update-po gettext publish $(SPHINXLCMDS) $(SPHINXCMDS)
+
+update-po: $(LOCALEFILES)
+
+gettext: locales/package.pot
+
+$(LOCALEFILES): locales/%/LC_MESSAGES/package.po: locales/package.pot
+ sphinx-intl update -p $(<D) -l $*
+ @touch $@
-locales: $(LOCALESDIRS)
+locales/package.pot: $(BUILDDIR)/gettext/package.pot | locales
+ cp $< $@
-$(LOCALESDIRS): gettext
- sphinx-intl update -p $(BUILDDIR)/gettext -l $(@F)
- touch $@
+$(DIRS):
+ mkdir -p $@
+
+$(BUILDDIR)/gettext/package.pot: $(MDFILES)
+ $(SPHINXBUILD) -M gettext "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O
+ @touch $@
publish: html
rsync -av --del _build/html/ $(USER)@$(PUBHOST):$(PUBDIR)
# Shinx commands that need locales.
-$(SPHINXLCMDS): $(if $(NOTFR),locales/$(LOCALE))
+$(SPHINXLCMDS): $(if $(NOTFR),locales/$(LOCALE)/LC_MESSAGES/package.po)
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXLANG) $(SPHINXOPTS) $O
# Other Sphinx commands for autocompletion
$(SPHINXCMDS):
- $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $0
-
-# Catch-all target: route all unknown targets to Sphinx using the new
-# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
-%: Makefile
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O
+
+clean:
+ rm -f locales/*/LC_MESSAGES/package.mo
+ rm -rf $(BUILDDIR)/*
diff --git a/conf.py b/conf.py
index 58ee832..e14ffdc 100644
--- a/conf.py
+++ b/conf.py
@@ -45,6 +45,12 @@ templates_path = ['_templates']
# Usually you set "language" from the command line for these cases.
language = 'fr'
+# Use a single POT and PO file par language.
+gettext_compact = 'package'
+
+# Display the translated string even if it is marked fuzzy.
+gettext_allow_fuzzy_translations = True
+
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.