Merge lp:~krytarik/xubuntu-docs/patches into lp:xubuntu-docs/vivid

Proposed by Krytarik Raido
Status: Merged
Merge reported by: David Pires
Merged at revision: not available
Proposed branch: lp:~krytarik/xubuntu-docs/patches
Merge into: lp:xubuntu-docs/vivid
Diff against target: 434 lines (+167/-158)
7 files modified
Makefile (+27/-18)
desktop-guide/Makefile (+40/-32)
desktop-guide/libs/xubuntu-docbook-conf.xsl (+9/-0)
scripts/translate.sh (+41/-52)
scripts/translators.sh (+44/-50)
startpage/xubuntu-index-end.htx (+3/-3)
startpage/xubuntu-index-start.htx (+3/-3)
To merge this branch: bzr merge lp:~krytarik/xubuntu-docs/patches
Reviewer Review Type Date Requested Status
David Pires Approve
Pasi Lallinaho (community) Needs Information
Review via email: mp+254485@code.launchpad.net

Description of the change

- Normalize appearance of cross references both throughout the various languages, and towards other links
- Move startpage from 'about' directory to document root, and rename it to 'index.html'
- Add option to include revision on startpage, by passing the REVNO parameter
- Change main docs' directory from 'desktop-guide' to 'C', to be consistent with the translations
- Change main docs' link on startpage to a relative one
- Reduce duplication of 'documentation' on startpage as well, and fix a couple of other things too
- Improve reliability and efficiency of creating the translator credits
- Overhaul translation script as well
- Improve efficiency and modularity of the Makefiles
- Adapt appearance of translators reference in the main docs to both the other credits, and the translations
- Use different clauses heading the translator credits for the main docs and the translations

To post a comment you must log in.
Revision history for this message
Pasi Lallinaho (knome) wrote :

See inline comment on code. Other than that, looks good to me.

review: Needs Information
Revision history for this message
Pasi Lallinaho (knome) :
Revision history for this message
David Pires (slickymaster) :
Revision history for this message
David Pires (slickymaster) :
review: Needs Information
Revision history for this message
David Pires (slickymaster) wrote :

Thanks for this krytarik.

Approved and merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2015-03-11 18:12:57 +0000
3+++ Makefile 2015-03-28 16:37:06 +0000
4@@ -1,16 +1,36 @@
5 # Makefile for the Xubuntu Documentation
6 # Ubuntu Documentation Project <ubuntu-doc@lists.ubuntu.com>
7
8+ifneq ($(REVNO),)
9+ VERSION =
10+ VERSION += (Rev. $(REVNO))
11+endif
12+
13+all: clean startpage html translate
14+
15+startpage: get-translations
16+ mkdir -p build
17+ cp startpage/*.css \
18+ startpage/*.png \
19+ build/
20+ sed "s@\(<a href=\"\).*\([^/]\+/index\.html\">Official Documentation</a>\)@\1\2$(VERSION)@" startpage/xubuntu-index-start.htx > build/index.html
21+ for lang in $(TRANSLATIONS); do \
22+ awk -v lang="$$lang" '$$1 == lang {print "\t\t\t<li><a href=\"" lang "/index.html\">" $$2 "</a></li>"; f=1; exit} END {exit !f}' desktop-guide/po/LINGUANAMES || \
23+ awk -v lang="$$lang" '$$1 == "\"Language-Team:" {print "\t\t\t<li><a href=\"" lang "/index.html\">" $$2 "</a></li>"; exit}' desktop-guide/po/$$lang.po; \
24+ done >> build/index.html
25+ cat startpage/xubuntu-index-end.htx >> build/index.html
26+
27+get-translations:
28 ifneq ($(wildcard desktop-guide/po/LINGUAS),)
29- $(shell cd desktop-guide && ../scripts/translate.sh -u >/dev/null)
30- TRANSLATIONS=$(shell cat desktop-guide/po/LINGUAS)
31+ cd desktop-guide; \
32+ ../scripts/translate.sh -u
33+ export TRANSLATIONS := $(shell cat desktop-guide/po/LINGUAS)
34+ export TRANSOPTS = -g
35 else
36- TRANSLATIONS=$(shell basename -s .po -a desktop-guide/po/*.po)
37+ export TRANSLATIONS := $(shell basename -s .po -a desktop-guide/po/*.po)
38 endif
39
40-all: clean desktop-guide startpage translate
41-
42-desktop-guide:
43+html:
44 make -C desktop-guide html
45
46 epub:
47@@ -19,17 +39,6 @@
48 translate:
49 make -C desktop-guide translate
50
51-startpage:
52- mkdir -p build/about/
53- cp startpage/*.css build/about/
54- cp startpage/*.png build/about/
55- cp startpage/xubuntu-index-start.htx build/about/xubuntu-index.html
56- for lang in $(TRANSLATIONS); do \
57- awk -v lang="$$lang" '$$1 == lang {print "\t\t\t<li><a href=\"../" lang "/index.html\">" $$2 "</a></li>"; f=1; exit} END {exit !f}' desktop-guide/po/LINGUANAMES || \
58- awk -v lang="$$lang" '$$1 == "\"Language-Team:" {print "\t\t\t<li><a href=\"../" lang "/index.html\">" $$2 "</a></li>"; exit}' desktop-guide/po/$$lang.po; \
59- done >> build/about/xubuntu-index.html
60- cat startpage/xubuntu-index-end.htx >> build/about/xubuntu-index.html
61-
62 test:
63 make -C desktop-guide test
64
65@@ -41,4 +50,4 @@
66 make -C desktop-guide clean
67 rm -rf build
68
69-.PHONY: desktop-guide startpage translate
70+.PHONY: startpage
71
72=== modified file 'desktop-guide/Makefile'
73--- desktop-guide/Makefile 2015-02-14 23:34:03 +0000
74+++ desktop-guide/Makefile 2015-03-28 16:37:06 +0000
75@@ -3,60 +3,68 @@
76 # Public domain
77
78 # Xubuntu Docbook Customization Layer
79-XUBUNTUXSL=libs/xubuntu-docbook-conf.xsl
80-
81-ifneq ($(wildcard po/LINGUAS),)
82- $(shell ../scripts/translate.sh -u >/dev/null)
83- OPTS=-g
84- TRANSLATIONS=$(shell cat po/LINGUAS)
85-else
86- OPTS=
87- TRANSLATIONS=$(shell basename -s .po -a po/*po)
88-endif
89+XUBUNTUXSL = libs/xubuntu-docbook-conf.xsl
90+
91+# All available translations
92+TRANSALL = $(shell basename -s .po -a po/*.po)
93+
94+all: clean html translate
95
96 html: style
97- @echo "<para>Attributed on each language's page.</para>" > C/translators.xml
98- xsltproc --xinclude -o ../build/desktop-guide/index.html $(XUBUNTUXSL) C/index.xml
99+ printf "<itemizedlist>\n\t<listitem><para>Attributed on each translation's page.</para></listitem>\n</itemizedlist>\n" > C/translators.xml
100+ xsltproc --xinclude -o ../build/C/index.html $(XUBUNTUXSL) C/index.xml
101+ sed -i 's@\(<p>The contributors to\) this translation of the \(documentation are:</p>\)@\1 the various translations of this \2@' ../build/C/credits-license.html
102
103 epub: epubstyle
104- @echo "<para>Attributed on each language's page.</para>" > C/translators.xml
105- xsltproc --xinclude -o ../build/desktop-guide/ /usr/share/xml/docbook/stylesheet/nwalsh/epub3/chunk.xsl C/index.xml
106- cd ../build/desktop-guide/; \
107- zip -0Xq xubuntu-docs.epub mimetype;\
108+ printf "<itemizedlist>\n\t<listitem><para>Attributed on each translation's page.</para></listitem>\n</itemizedlist>\n" > C/translators.xml
109+ xsltproc --xinclude -o ../build/C/ /usr/share/xml/docbook/stylesheet/nwalsh/epub3/chunk.xsl C/index.xml
110+ sed -i 's@\(<p>The contributors to\) this translation of the \(documentation are:</p>\)@\1 the various translations of this \2@' ../build/C/credits-license.html
111+ cd ../build/C; \
112+ zip -0Xq xubuntu-docs.epub mimetype; \
113 zip -Xr9Dq xubuntu-docs.epub *
114
115 style:
116 mkdir -p ../build/libs
117- cp -r libs/*css ../build/libs
118- cp -r libs/images ../build/libs
119- cp -r libs/admon ../build/libs
120- cp -r libs/navig ../build/libs
121+ cp -r libs/*.css \
122+ libs/images \
123+ libs/admon \
124+ libs/navig \
125+ ../build/libs/
126
127 epubstyle:
128- mkdir -p ../build/desktop-guide/libs/images
129- cp -r libs/images/preferences-desktop.png \
130+ mkdir -p ../build/C/libs/images
131+ cp libs/images/preferences-desktop.png \
132 libs/images/system-lock-screen.png \
133 libs/images/system-log-out.png \
134 libs/images/location_icon.png \
135 libs/images/package_icon.png \
136 libs/images/menu_icon.png \
137 libs/images/key_icon.png \
138- ../build/desktop-guide/libs/images/
139+ ../build/C/libs/images/
140
141-translate:
142- ../scripts/translate.sh $(OPTS); \
143+translate: get-translations
144+ ../scripts/translate.sh $(TRANSOPTS)
145+ ../scripts/translators.sh $(TRANSOPTS)
146 for dir in $(TRANSLATIONS); do \
147- ../scripts/translators.sh -l $$dir > $$dir/translators.xml ;\
148- xsltproc --xinclude -o ../build/$$dir/index.html $(XUBUNTUXSL) $$dir/index.xml ;\
149+ xsltproc --xinclude -o ../build/$$dir/index.html $(XUBUNTUXSL) $$dir/index.xml; \
150 done
151
152-test:
153+test: get-translations
154 set -e; \
155 for dir in C $(TRANSLATIONS); do \
156- ../scripts/validate.sh $$dir/index.xml ;\
157+ ../scripts/validate.sh $$dir/index.xml; \
158 done
159
160+get-translations:
161+ifeq ($(TRANSLATIONS),)
162+ ifneq ($(wildcard po/LINGUAS),)
163+ ../scripts/translate.sh -u
164+ TRANSLATIONS := $(shell cat po/LINGUAS)
165+ TRANSOPTS = -g
166+ else
167+ TRANSLATIONS := $(TRANSALL)
168+ endif
169+endif
170+
171 clean:
172- ${RM} -r $(TRANSLATIONS) C/translators.xml
173-
174-.PHONY: html translate
175+ ${RM} -r $(TRANSALL) C/translators.xml
176
177=== modified file 'desktop-guide/libs/xubuntu-docbook-conf.xsl'
178--- desktop-guide/libs/xubuntu-docbook-conf.xsl 2015-02-11 19:52:57 +0000
179+++ desktop-guide/libs/xubuntu-docbook-conf.xsl 2015-03-28 16:37:06 +0000
180@@ -89,4 +89,13 @@
181 <xsl:value-of select="'inline-icon-submenu'"/>
182 </xsl:template>
183
184+ <!-- Normalize appearance of cross references -->
185+ <xsl:template match="bridgehead|refsection|refsect1|refsect2|refsect3|sect1|sect2
186+ |sect3|sect4|sect5|section|simplesect" mode="object.xref.template">
187+ <xsl:text>%t</xsl:text>
188+ </xsl:template>
189+
190+ <!-- Disable tooltips on links -->
191+ <xsl:template match="*" mode="html.title.attribute"/>
192+
193 </xsl:stylesheet>
194
195=== modified file 'scripts/translate.sh'
196--- scripts/translate.sh 2015-02-15 02:42:56 +0000
197+++ scripts/translate.sh 2015-03-28 16:37:06 +0000
198@@ -26,62 +26,51 @@
199 #
200 # Optional parameters:
201 # -g Translate for every language listed in po/LINGUAS
202-# -l<language>
203-# -u Update the list of translations in po/LINGUAS
204+# -l <language>
205+# -u Update the list of languages in po/LINGUAS
206 #
207
208-translate() {
209- lang=$(basename ${1} .po)
210- echo " --Translating ${lang}"
211- mkdir -p ${lang}
212- for i in C/*xml; do
213- xml=$(basename ${i} C/)
214- xml2po --expand-all-entities --po-file po/${lang}.po C/${xml} >${lang}/${xml}
215+translate () {
216+ for lang in $@; do
217+ echo "Translating $lang ..."
218+ mkdir -p $lang
219+ for xml in C/*.xml; do
220+ xml=$(basename $xml)
221+ xml2po --expand-all-entities --po-file po/$lang.po C/$xml > $lang/$xml
222 done
223- if [ -e C/${document}-C.omf ]; then
224- xml2po --expand-all-entities --po-file ${1} C/${document}-C.omf >${lang}/${document}-${lang}.omf
225- sed -i -e s@\"C\"@\"${lang}\"@g -e s@C/@${lang}/@g ${lang}/${document}-${lang}.omf
226- fi
227-}
228-
229-choose_language() {
230- if [ ${1} ]; then
231- translate "po/${1}.po"
232- else
233- for x in po/*.po; do
234- translate ${x}
235- done
236- fi
237-}
238-
239-shipped_languages() {
240-percent=70
241-for po in po/*.po
242-do
243- if [ `msgfmt -o /dev/null --statistics $po 2>&1|awk '{printf("%.0f\n",$1 / ($1 + $4 + $7) * 100)}'` -ge "${percent}" ];then
244- basename $po .po
245- fi
246-done | tee po/LINGUAS
247-exit
248-}
249-
250-while getopts ":gl:u" Option
251-do
252- case ${Option} in
253- g) generated=yes;;
254- l) language=${OPTARG};;
255- u) shipped_languages;;
256- *) echo "Please specify an argument.";;
257- esac
258+ done
259+}
260+
261+shipped_languages () {
262+ percreq="70"
263+ echo "Updating LINGUAS ..."
264+ for po in po/*.po; do
265+ percdone=$(msgfmt -o /dev/null --statistics $po 2>&1 | awk '{printf "%.0f\n", $1 / ($1 + $4 + $7) * 100}')
266+ if [ "$percdone" -ge "$percreq" ]; then
267+ basename $po .po
268+ fi
269+ done | tee po/LINGUAS
270+}
271+
272+while getopts ":gl:u" opt; do
273+ case $opt in
274+ g)
275+ generated="yes";;
276+ l)
277+ language=$OPTARG;;
278+ u)
279+ shipped_languages
280+ exit;;
281+ esac
282 done
283
284-if [ ${language} ]; then
285- choose_language ${language}
286-elif [ ${generated} ] && [ -f po/LINGUAS ];then
287- for language in `cat po/LINGUAS`
288- do
289- choose_language ${language}
290- done
291+if [ "$generated" = "yes" ]; then
292+ if [ ! -f po/LINGUAS ]; then
293+ shipped_languages
294+ fi
295+ translate $(cat po/LINGUAS)
296+elif [ -n "$language" ]; then
297+ translate $language
298 else
299- choose_language
300+ translate $(basename -s .po -a po/*.po)
301 fi
302
303=== modified file 'scripts/translators.sh'
304--- scripts/translators.sh 2015-02-14 23:09:26 +0000
305+++ scripts/translators.sh 2015-03-28 16:37:06 +0000
306@@ -1,52 +1,46 @@
307 #!/bin/sh
308
309-CURDIR=$(pwd)/po/
310-
311-get_languages() {
312-if [ "$generated" = yes ];then
313- languages=$(cat po/LINGUAS)
314-elif [ -n $language ];then
315- languages=$language
316-else
317- languages=$(basename -s.po $CURDIR/*.po)
318-fi
319-}
320-
321-build_creds() {
322-#for lang in `basename -s.po *.po`;do ## Good for testing, uses all translations it can find.
323-echo "<itemizedlist>"
324-for lang in $languages;do
325- mkdir -p $CURDIR/mo/$lang/LC_MESSAGES/
326- msgfmt -o $CURDIR/mo/$lang/LC_MESSAGES/xubuntu-docs.mo $CURDIR/$lang.po
327- translators=$(TEXTDOMAINDIR=$CURDIR/mo/ LANGUAGE=$lang gettext -d xubuntu-docs -s 'translator-credits' | \
328- sed -e 's@^ @\t<listitem><para>@' -e '/launchpad.net/s@$@)</para></listitem>@' \
329- -e 's@https://launchpad.net/~@(@' -e /Launchpad\ Contributions/d -e /^translator-credits$/d | sort -u)
330-done
331-if [ "$translators" = "" ];then
332- echo "<listitem><para>Unable to parse translator data or data unavailable, see <ulink url=\"https://translations.launchpad.net/xubuntu-docs/\">Launchpad</ulink></para></listitem>"
333-else
334- echo "$translators"
335-fi
336-echo "</itemizedlist>"
337-rm -rf $CURDIR/mo/
338-}
339-
340-grep_creds() {
341-## Don't build, just grep.
342-## This is incomplete and unused, potentially helpful later.
343-for lang in $languages;do
344- echo msggrep --msgid -F -e 'translator-credits' $lang.po
345-done
346-}
347-
348-while getopts ":gl:" Option
349-do
350- case ${Option} in
351- g) generated=yes;;
352- l) language=${OPTARG};;
353- *) echo "Please specify an argument.";;
354- esac
355-done
356-
357-get_languages
358-build_creds
359+build_creds () {
360+ for lang in $@; do
361+ translators=$(sed -n '/^msgid "translator-credits"/,/^$/ {s@^"[ ]*\(.\+\)[ ]\+https://launchpad.net/~\([^ \\"]\+\).*$@\t<listitem><para>\1 (\2)</para></listitem>@p;/^$/Q}' po/$lang.po | sort -u)
362+ if [ -z "$translators" ]; then
363+ translators='\t<listitem><para>Translator data could not be acquired, please see <ulink url="https://translations.launchpad.net/xubuntu-docs">Launchpad</ulink>.</para></listitem>'
364+ fi
365+ printf "<itemizedlist>\n%b\n</itemizedlist>\n" "$translators" > $lang/translators.xml
366+ done
367+}
368+
369+build_creds_alt () {
370+ for lang in $@; do
371+ mkdir -p po/mo/$lang/LC_MESSAGES
372+ msgfmt -o po/mo/$lang/LC_MESSAGES/xubuntu-docs.mo po/$lang.po
373+ translators=$(TEXTDOMAINDIR=po/mo LANGUAGE=$lang gettext -d xubuntu-docs -s 'translator-credits' | \
374+ sed -n 's@^[ ]*\(.\+\)[ ]\+https://launchpad.net/~\([^ ]\+\).*$@\t<listitem><para>\1 (\2)</para></listitem>@p' | sort -u)
375+ if [ -z "$translators" ]; then
376+ translators='\t<listitem><para>Translator data could not be acquired, please see <ulink url="https://translations.launchpad.net/xubuntu-docs">Launchpad</ulink>.</para></listitem>'
377+ fi
378+ printf "<itemizedlist>\n%b\n</itemizedlist>\n" "$translators" > $lang/translators.xml
379+ done
380+ rm -rf po/mo
381+}
382+
383+while getopts ":gl:" opt; do
384+ case $opt in
385+ g)
386+ generated="yes";;
387+ l)
388+ language=$OPTARG;;
389+ esac
390+done
391+
392+if [ "$generated" = "yes" ]; then
393+ if [ ! -f po/LINGUAS ]; then
394+ ../scripts/translate.sh -u
395+ fi
396+ build_creds $(cat po/LINGUAS)
397+elif [ -n "$language" ]; then
398+ build_creds $language
399+else
400+ build_creds $(basename -s .po -a po/*.po)
401+fi
402+
403
404=== modified file 'startpage/xubuntu-index-end.htx'
405--- startpage/xubuntu-index-end.htx 2014-09-13 14:18:06 +0000
406+++ startpage/xubuntu-index-end.htx 2015-03-28 16:37:06 +0000
407@@ -1,8 +1,8 @@
408 </ul>
409
410- <h2>Other support methods</h2>
411- <p>If you can't find the answer to your question in the Official Documentation, there are other ways to get help and support for Xubuntu. The complete list of support methods can be found on the <a href="http://xubuntu.org/help">Help & Support</a> section of our website.</p>
412- <p>To get live help, join the <a href="http://webchat.freenode.net/?channels=xubuntu&nick=xubuntu..d&prompt=1">#xubuntu</a> channel on the Freenode IRC Network.</p>
413+ <h2>Other Support Methods</h2>
414+ <p>If you can't find the answer to your question in the Official Documentation, there are other ways to get help and support for Xubuntu. The complete list of support methods can be found in the <a href="http://xubuntu.org/help/">Help & Support</a> section of our website.</p>
415+ <p>To get live help, join the <a href="http://webchat.freenode.net/?channels=xubuntu&nick=xubuntu..d&prompt=1">#xubuntu</a> channel on the Freenode IRC network.</p>
416
417 <p>When you are seeking for help, please note that most of the general Ubuntu help also applies to Xubuntu.</p>
418
419
420=== modified file 'startpage/xubuntu-index-start.htx'
421--- startpage/xubuntu-index-start.htx 2015-01-11 21:50:34 +0000
422+++ startpage/xubuntu-index-start.htx 2015-03-28 16:37:06 +0000
423@@ -19,8 +19,8 @@
424 <div id="content">
425 <h1>Welcome to Xubuntu 15.04 Documentation!</h1>
426
427- <h2>Official documentation</h2>
428- <p>The <a href="file:///usr/share/xubuntu-docs/desktop-guide/index.html">Official Documentation</a> provides documentation to the most common issues with Xubuntu.</p>
429+ <h2>Official Documentation</h2>
430+ <p>The <a href="C/index.html">Official Documentation</a> provides information to the most common issues with Xubuntu.</p>
431
432- <h3>Official documentation in other languages</h3>
433+ <h3>In other languages</h3>
434 <ul class="inline">

Subscribers

People subscribed via source and target branches