From 5de7786306af5c66a69ff01fd4b6ceb929681a5f Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Fri, 25 Mar 2022 14:34:44 +0100 Subject: better prepare gettext translations - copy pot file in dir to add it to git repo - make sphinx cmds that build docs require %.po files - compile all messages in a single .pot - allow fuzzy messages to be used --- Makefile | 44 ++++++++++++++++++++++++++++---------------- conf.py | 6 ++++++ 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 $(