On Fri, May 17, 2019 at 02:31:19PM +0200, Frans Spiesschaert wrote: > This means also that already translated strings can suddenly show up > again as to be translated. This is e.g. frequently the case for > template 2 of the manual, each time the date stamp changes. Esp. the date stamp issue is annoying. I have a local modification which would avoid the title re-translation each time, but I guess it's too invasive for buster. Might be useful for bullseye... Wolfgang
From 37b2f70d8ccc1691e74a88fae8bfb37fc64b5ad9 Mon Sep 17 00:00:00 2001
From: Wolfgang Schweer <wschweer@arcor.de>
Date: Fri, 17 May 2019 15:11:38 +0200
Subject: [PATCH] Drop publication date from the manual title, use XML subtitle
instead.
It moves the publication date setting from the get_manual script to
Makefile.common; running 'make update' for all manuals is required once to set
things up. The manual publication date will be take from debian/changelog.
Also, Makefile.common has been cleaned up to be better maintainable.
As a benefit, separate XML file generation is also possible ('make xml').
README.common-translations adjusted accordingly.
edu.css.xml adjusted to format the publication date field.
Signed-off-by: Wolfgang Schweer <wschweer@arcor.de>
---
documentation/common/Makefile.common | 174 ++++++++++--------
.../common/README.common-translations | 31 ++--
documentation/common/edu.css.xml | 4 +
documentation/scripts/get_manual | 6 +-
4 files changed, 125 insertions(+), 90 deletions(-)
diff --git a/documentation/common/Makefile.common b/documentation/common/Makefile.common
index cb0aa72a..36564dc9 100644
--- a/documentation/common/Makefile.common
+++ b/documentation/common/Makefile.common
@@ -1,5 +1,5 @@
#
-# no configuration below
+# language specific date formatting config below (default is yyyy-mm-dd).
#
DESTDIR=
DESTPATH = /usr/share/doc
@@ -11,7 +11,17 @@ LANGUAGES = $(subst $(name).,,$(subst .po,,$(wildcard *.po)))
DBTOEPUB = dbtoepub
XP = xsltproc --nonet --novalid --xinclude ../common/html.xsl
DBLATEX = SOURCE_DATE_EPOCH=$$SOURCE_DATE_EPOCH SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1 dblatex "--tmpdir=texdir" -T native -b xetex -p ../common/dblatex.xsl
-SED_JA_REGEX = 's/dbtimestamp/dbtimestamp\ format=\"Y\ 年\ m\ 月\ d\ 日\"/'
+# Language specific date formatting
+DATE_00 = $(shell dpkg-parsechangelog -l ../../debian/changelog -S Date | date -u "+%Y"-"%m"-"%d" -f -)
+DATE_01 = $(shell dpkg-parsechangelog -l ../../debian/changelog -S Date | date -u "+%d"."%m"."%Y" -f -)
+DATE_02 = $(shell dpkg-parsechangelog -l ../../debian/changelog -S Date | date -u "+%d"-"%m"-"%Y" -f -)
+DATE_03 = $(shell dpkg-parsechangelog -l ../../debian/changelog -S Date | date -u "+%Y"年"%m"月"%d"日 -f -)
+DATE_04 = $(shell dpkg-parsechangelog -l ../../debian/changelog -S Date | date -u "+%d"/"%m"/"%Y" -f -)
+SED_00= 's%</para><para> </para>%$(DATE_00)</para>%'
+SED_01= 's%</para><para> </para>%$(DATE_01)</para>%'
+SED_02= 's%</para><para> </para>%$(DATE_02)</para>%'
+SED_03= 's%</para><para> </para>%$(DATE_03)</para>%'
+SED_04= 's%</para><para> </para>%$(DATE_04)</para>%'
# Use Make internal function 'subst': substitute -manual with nothing to get
# the directory name.
@@ -41,98 +51,118 @@ status:
build: build-html build-epub
ifndef LINGUA
-build-html:
+build-xml:
# create localized XML files
po4a --msgmerge-opt --no-location po4a.cfg
+ # rewrap the PO file just to be sure
msgcat --no-location -o $(name).pot $(name).pot
-
- # build the English HTML version
- $(XP) $(name).xml && mv index.html $(name).en.html
- # restore internal links
- sed -i "s/href=\"index.html/href=\"$(name).en.html/g" $(name).en.html
- # build the other HTML versions
- -for f in $(LANGUAGES) ; do \
- echo "Creating HTML for $$f"; \
- if [ "$$f" = "ja" ] ; then \
- sed -i $(SED_JA_REGEX) $(name).$$f.xml ; \
- fi ; \
- $(XP) $(name).$$f.xml && mv index.html $(name).$$f.html ; \
- sed -i "s/href=\"index.html/href=\"$(name).$$f.html/g" $(name).$$f.html ; \
- done
-build-epub:
- # build the English EPUB version
- echo "Creating epub for en"
- $(DBTOEPUB) $(name).xml
- unzip -q $(name).epub -d epub
- sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/content.opf
- sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/toc.ncx
- find epub -exec touch -d @0 {} \;
- rm $(name).epub
- zip -q -r -o $(name).epub epub/
- rm -rf epub/
- strip-nondeterminism -t zip $(name).epub
- # build all other EPUB versions
- -for LINGUA in $(LANGUAGES) ; do \
- echo "Creating epub for $$LINGUA"; \
- po4a --translate-only $(name).$$LINGUA.xml po4a.cfg ; \
- mkdir images-tmp ; \
- cp images/*.* images-tmp/ ; \
- if [ -e images/$$LINGUA ] ; then \
- cp -v images/$$LINGUA/*.* images-tmp/ ; \
- fi ; \
- sed -i "s#./images#./images-tmp#g" $(name).$$LINGUA.xml ; \
- $(DBTOEPUB) $(name).$$LINGUA.xml ; \
- sed -i "s#./images-tmp#./images/#g" $(name).$$LINGUA.xml ; \
- rm -rf images-tmp/ ; \
+ # special case English master file
+ cp $(name).xml $(name).en.xml
+ # build XML version for all languages
+ for f in en $(LANGUAGES) ; do \
+ echo "Creating XML for $$f"; \
+ case "$$f" in \exit
+ cs|de|da|nb|pl) sed -i $(SED_01) $(name).$$f.xml \
+ ;; \
+ fr|nl) sed -i $(SED_02) $(name).$$f.xml \
+ ;; \
+ ja) sed -i $(SED_03) $(name).$$f.xml \
+ ;; \
+ es|it|pt-br) sed -i $(SED_04) $(name).$$f.xml \
+ ;; \
+ *) sed -i $(SED_00) $(name).$$f.xml \
+ ;; \
+ esac ; \
done
else
-build-html:
+build-xml:
# create the localized XML file
po4a --translate-only $(name).$(LINGUA).xml po4a.cfg
# rewrap the PO file just to be sure
msgcat -o $(name).$(LINGUA).po $(name).$(LINGUA).po
+ # build the XML file
+ case "$(LINGUA)" in \
+ cs|de|da|nb|pl) sed -i $(SED_01) $(name).$(LINGUA).xml \
+ ;; \
+ fr|nl) sed -i $(SED_02) $(name).$(LINGUA).xml \
+ ;; \
+ ja) sed -i $(SED_03) $(name).$(LINGUA).xml \
+ ;; \
+ es|it) sed -i $(SED_04) $(name).$(LINGUA).xml \
+ ;; \
+ *) sed -i $(SED_00) $(name).$(LINGUA).xml \
+ ;; \
+ esac
+endif
+
+ifndef LINGUA
+build-html: build-xml
+ # build HTML version for all languages
+ for f in en $(LANGUAGES) ; do \
+ echo "Creating HTML for $$f"; \
+ $(XP) $(name).$$f.xml && mv index.html $(name).$$f.html ; \
+ # restore internal links
+ sed -i "s/href=\"index.html/href=\"$(name).$$f.html/g" $(name).$$f.html ; \
+ done
+else
+build-html: build-xml
# build the HTML file
- if [ "$(LINGUA)" = "ja" ] ; then \
- sed -i $(SED_JA_REGEX) $(name).$(LINGUA).xml ; \
- fi ; \
$(XP) $(name).$(LINGUA).xml && mv index.html $(name).$(LINGUA).html
# restore internal links
sed -i "s/href=\"index.html/href=\"$(name).$(LINGUA).html/g" $(name).$(LINGUA).html
-build-epub: epub
endif
ifndef LINGUA
-pdf:
- $(DBLATEX) $(name).xml --param=lingua=en
+build-epub: build-xml
+ # build EPUB version for all languages
+ for f in en $(LANGUAGES) ; do \
+ echo "Creating EPUB for $$f"; \
+ mkdir images-tmp ; \
+ cp images/*.* images-tmp/ ; \
+ if [ -e images/$$f ] ; then \
+ cp -v images/$$f/*.* images-tmp/ ; \
+ fi ; \
+ sed -i "s#./images#./images-tmp#g" $(name).$$f.xml ; \
+ $(DBTOEPUB) $(name).$$f.xml ; \
+ rm -rf images-tmp ; \
+ done
else
-pdf:
- po4a --translate-only $(name).$(LINGUA).xml po4a.cfg
+build-epub: build-xml
+ mkdir images-tmp
+ cp images/*.* images-tmp/
+ if [ -e images/$(LINGUA) ] ; then \
+ cp -v images/$(LINGUA)/*.* images-tmp/ ; \
+ fi
+ sed -i "s#./images#./images-tmp#g" $(name).$(LINGUA).xml
+ $(DBTOEPUB) $(name).$(LINGUA).xml
+ rm -rf images-tmp
+endif
+
+ifndef LINGUA
+pdf: build-xml
+ sed -i $(SED_00) $(name).en.xml
+ $(DBLATEX) $(name).en.xml --param=lingua=en
+else
+pdf: build-xml
$(DBLATEX) $(name).$(LINGUA).xml --param=lingua=$(LINGUA)
endif
ifndef LINGUA
-epub:
- $(DBTOEPUB) $(name).xml
- unzip -q $(name).epub -d epub
- sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/content.opf
- sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/toc.ncx
- find epub -exec touch -d @0 {} \;
- rm $(name).epub
- zip -q -r -o $(name).epub epub/
- rm -rf epub/
- strip-nondeterminism -t zip $(name).epub
+xml: build-xml
else
-epub:
- po4a --translate-only $(name).$(LINGUA).xml po4a.cfg
- $(DBTOEPUB) $(name).$(LINGUA).xml
- unzip -q $(name).$(LINGUA).epub -d epub
- sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/content.opf
- sed -i 's#_idm[0-9]\{14\}#_idm1234567#' epub/OEBPS/toc.ncx
- find epub -exec touch -d @0 {} \;
- rm $(name).$(LINGUA).epub
- zip -q -r -o $(name).$(LINGUA).epub epub/
- rm -rf epub/
- strip-nondeterminism -t zip $(name).$(LINGUA).epub
+xml: build-xml
+endif
+
+ifndef LINGUA
+html: build-html
+else
+html: build-html
+endif
+
+ifndef LINGUA
+epub: build-epub
+else
+epub: build-epub
endif
install: build
diff --git a/documentation/common/README.common-translations b/documentation/common/README.common-translations
index 9a024a99..cc4d6bb2 100644
--- a/documentation/common/README.common-translations
+++ b/documentation/common/README.common-translations
@@ -9,8 +9,8 @@ Install the build dependencies of the package plus some extra packages (which
are needed for working on the translations, the package itself builds fine without
them):
-sudo apt-get build-dep debian-edu-doc
-sudo apt-get install po4a texlive-latex-recommended texlive-latex-extra \
+sudo apt build-dep debian-edu-doc
+sudo apt install po4a texlive-latex-recommended texlive-latex-extra \
texlive-fonts-recommended texlive-fonts-extra dblatex wget libxml2-utils
Please note: pdflatex depends on ($texlive-packages | $tetex-packages) - we
@@ -29,11 +29,11 @@ Simply copy the POT file as a PO file:
$ cp ##NAME##.pot ##NAME##.da.po # create a new Danish PO file
$ git add ##NAME##.da.po # add it to the VCS
$ vi ##NAME##.da.po # better use Lokalize for this :)
+$ LINGUA=da make xml # check the build and rewrap the PO file
$ git commit ##NAME##.da.po # commit the new translation for the first time
$ git push # update the remote repository
-
How to update the translations
------------------------------
@@ -43,29 +43,32 @@ strings:
$ git pull # update from the VCS, maybe someone else translated
# something or the English source was updated
$ vi ##NAME##.da.po # again, better use Lokalize
-$ LINGUA=da make # check the build and rewrap the PO file
+$ LINGUA=da make xml # check the build and rewrap the PO file
$ git diff ##NAME##.da.po # check the differences from the previous file
$ git commit ##NAME##.da.po # commit changes to your local repository
$ git push # update the remote repository
-How to build the HTML version
------------------------------
-
-$ make # build all HTML versions.
+How to build the HTML, PDF and EPUB versions.
+---------------------------------------------
-Even faster:
+$ make html pdf epub # build all versions for all translations.
-$ LINGUA=da make # build only the Danish translation in HTML.
+Even faster for a single language, e.g. Danish:
+$ LINGUA=da make html # build only the Danish translation in HTML.
You can also build the PDF:
-
-$ LINGUA=da make pdf # build only the Danish translation in PDF.
-
-The English pictures will used for these test builds, but localized images
+$ LINGUA=da make pdf # build only the Danish translation in PDF.
+The English pictures will be used for this test build, but localized images
will be used during the actual build process (if they exist).
+Build the EPUB, too:
+$ LINGUA=da make epub # build only the Danish translation in PDF.
+Existing localized images will replace English ones.
+
+Cleaning up after having checked that things are okay:
+$ make clean
Translating notes
-----------------
diff --git a/documentation/common/edu.css.xml b/documentation/common/edu.css.xml
index e333ff81..8c065cf8 100644
--- a/documentation/common/edu.css.xml
+++ b/documentation/common/edu.css.xml
@@ -42,6 +42,10 @@ h1.title, h2.title, h3.title, h4.title, h5.title, h6.title {
width: 100%;
}
+h3.subtitle {
+ font: normal 100% sans-serif;
+}
+
body hr {
margin: .6em;
border-width: 0 0 1px 0;
diff --git a/documentation/scripts/get_manual b/documentation/scripts/get_manual
index b4873f4b..f3313d8b 100755
--- a/documentation/scripts/get_manual
+++ b/documentation/scripts/get_manual
@@ -166,10 +166,8 @@ echo "calling ../scripts/get_images $xmlfile $path1"
# -0\777 read multiple lines
perl -0\777 -pi -e "s/<ulink url=\"$path2(.*)\/(.*)\">(.*)\n<\/ulink>/<link linkend=\"\2\">\3<\/link>/g" $xmlfile
-# set DOC_DATE based on current date as get_manual is only called manually when the document is updated from the wiki
-DOC_DATE="$(TZ=UTC date +'%Y-%m-%d')"
-# make it a docbook article again
-sed -i "1,/</ s#<#<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook XML V4.4//EN\" \"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd\"><article lang=\"en\"><articleinfo><title>$DEBIAN_EDU_DOC_TITLE $DOC_DATE</title></articleinfo>\n<#" $xmlfile
+# make it a docbook article again; weird hack for subtitle to get a translatable string and a separate space for the date, see Makefile.common.
+sed -i "1,/</ s#<#<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook XML V4.4//EN\" \"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd\"><article lang=\"en\"><articleinfo><title>$DEBIAN_EDU_DOC_TITLE</title><subtitle><para>Publish date: </para><para>\ </para></subtitle></articleinfo>\n<#" $xmlfile
sed -i "$ s#>#>\n</article>#" $xmlfile
# remove the first empty lines
sed -i "1,2d" $xmlfile
--
2.20.1
Attachment:
signature.asc
Description: PGP signature