From e4a912b6776a33d3092d70155a8a2a4a09542d7e Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Mon, 28 Mar 2022 22:17:04 +0200 Subject: fix: dirty locale files management -> use gettext mainly get rid of sphinx intl and use genuine gettext utilities. - move back .pot file generation from sphinx to _build - copy .pot files from _build using xgettext (correct width and metadata) - enforce consitent width and metadata order with Weblate using msgmerge - Make now correctly tracks locales files dependencies - update README with new deps and descriptions - remove sphinx intl from deps and github action - Sphinx get basic metadata from ENVVARS set by Make --- .github/workflows/build.yml | 2 +- .gitignore | 1 - Makefile | 58 +++---- README.md | 14 +- conf.py | 10 +- locales/en/LC_MESSAGES/package.po | 354 +++++++++++++++++++------------------- locales/en/LC_MESSAGES/sphinx.po | 14 +- locales/package.pot | 317 +++++++++++++++++++++------------- locales/sphinx.pot | 14 +- 9 files changed, 426 insertions(+), 358 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1ea954..b9cea54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: - name: Build HTML uses: XanaduAI/sphinx-action@08cb9868314fb5be5f28644b540a38b8faaf8e87 with: - pre-build-command: pip install myst-parser sphinx-rtd-theme sphinx-intl + pre-build-command: pip install myst-parser sphinx-rtd-theme docs-folder: . - name: Install RSA key env: diff --git a/.gitignore b/.gitignore index fee9244..6501908 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ # Project generated files _build *.mo -.doctrees # Editor files .*.swp diff --git a/Makefile b/Makefile index 204f593..3e2837f 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,14 @@ # Minimal makefile for Sphinx documentation # # You can set these variables from the command line. -ifneq (,$(filter grouped-target,$(.FEATURES))) -GROUPED_TARGET := 1 -else -$(warning WARNING: This version of make does not support grouped-target, disabling parallel jobs.) -.NOTPARALLEL: -endif LOCALES := en -LOCALEFILES := $(LOCALES:%=locales/%/LC_MESSAGES/package.po) -PONAMES := package sphinx -POTS := $(PONAMES:%=locales/%.pot) +LOCALEFILES := $(LOCALES:%=locales/%/LC_MESSAGES/package.po) $(LOCALES:%=locales/%/LC_MESSAGES/sphinx.po) + +export COPYRIGHT := Nicolas PEUGNET +export PACKAGE := CLUB1 +export VERSION := main +export EMAIL := nicolas@club1.fr export LANGUAGES := fr $(LOCALES) export LATEXMKOPTS := -quiet @@ -22,12 +19,9 @@ SPHINXBUILD ?= sphinx-build SPHINXBUILDERS := html dirhtml singlehtml epub latex text man texinfo SPHINXLBUILDERS := $(foreach b,$(SPHINXBUILDERS),$(LANGUAGES:%=$b/%)) SPHINXHBUILDERS := $(SPHINXBUILDERS:%=_%) -SPHINXCMDS := pickle json htmlhelp changes xml pseudoxml linkcheck doctest coverage +SPHINXCMDS := gettext pickle json htmlhelp changes xml pseudoxml linkcheck doctest coverage SOURCEDIR := . BUILDDIR := _build -MDFILES := index.md $(shell find . -type f -name '*.md') -MDFILES := $(shell find . -type f -name '*.md' -not -name 'README.*') -TEMPLATES := $(shell find _templates -type f -name '*.html') PUBHOST ?= club1.fr PUBDIR ?= /var/www/docs @@ -36,25 +30,26 @@ PUBDIR ?= /var/www/docs help: $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $O -.PHONY: help clean update-po gettext latexpdf info publish $(SPHINXBUILDERS) $(SPHINXLBUILDERS) $(SPHINXHBUILDERS) $(SPHINXCMDS) +.PHONY: help clean update-po latexpdf info publish $(SPHINXBUILDERS) $(SPHINXLBUILDERS) $(SPHINXHBUILDERS) $(SPHINXCMDS) -update-po: $(LOCALEFILES) +update-po: $(LOCALEFILES); -gettext: $(POTS) +%.mo: %.po + msgfmt -o $@ $< -$(LOCALEFILES): locales/%/LC_MESSAGES/package.po: $(POTS) .FORCE - sphinx-intl update -p $(