Merge lp:~unit193/xubuntu-docs/linguas into lp:xubuntu-docs/trusty

Proposed by Unit 193
Status: Merged
Merged at revision: 148
Proposed branch: lp:~unit193/xubuntu-docs/linguas
Merge into: lp:xubuntu-docs/trusty
Diff against target: 282 lines (+75/-78)
9 files modified
Makefile (+6/-2)
debian/compat (+1/-1)
debian/control (+2/-3)
debian/rules (+2/-2)
desktop-guide/Makefile (+19/-1)
desktop-guide/po/LINGUAS (+3/-0)
scripts/rename-rosetta-po-files.sh (+0/-3)
scripts/translate.sh (+42/-33)
scripts/yelptest (+0/-33)
To merge this branch: bzr merge lp:~unit193/xubuntu-docs/linguas
Reviewer Review Type Date Requested Status
Pasi Lallinaho (community) Approve
Jack Fromm (community) Abstain
Micah Gersten Pending
Review via email: mp+205281@code.launchpad.net

Description of the change

* Updated the debian/ dir to remove cdbs and switch to dh.
* Intruduced the po/LINGUAS file to specify what translations to ship, and updated the Makefiles accordingly.
* Did an overhaul on the scripts/translate.sh script.
* Removed unused additional scripts.

To post a comment you must log in.
lp:~unit193/xubuntu-docs/linguas updated
134. By Unit 193 <unit193@Sigma>

Remove additional scripts.

Revision history for this message
Jack Fromm (jjfrv8) wrote :

Unit193, thanks. Of course I have no idea what I'm looking at ;)

review: Abstain
Revision history for this message
Pasi Lallinaho (knome) :
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 2012-09-18 00:31:15 +0000
3+++ Makefile 2014-02-07 01:59:54 +0000
4@@ -1,11 +1,14 @@
5 # Makefile for the Xubuntu Documentation
6 # Ubuntu Documentation Project <ubuntu-doc@lists.ubuntu.com>
7
8-all: clean desktop-guide startpage
9+all: clean desktop-guide startpage translate
10
11 desktop-guide:
12 make -C desktop-guide html
13
14+translate:
15+ make -C desktop-guide translate
16+
17 startpage:
18 cp -r startpage/ build/about
19
20@@ -14,10 +17,11 @@
21 tar cvfz xubuntu-doc.tar.gz --exclude="*.tar.gz" --exclude="*~" --exclude "*.bzr*" *
22
23 clean:
24+ make -C desktop-guide clean
25 rm -rf build
26
27 commit-clean:
28 find . -name "*.po" -exec rm \{\} \+
29 find . -name "*.pot" -exec rm \{\} \+
30
31-.PHONY: desktop-guide startpage
32+.PHONY: desktop-guide startpage translate
33
34=== modified file 'debian/compat'
35--- debian/compat 2012-09-19 20:32:28 +0000
36+++ debian/compat 2014-02-07 01:59:54 +0000
37@@ -1,1 +1,1 @@
38-8
39+9
40
41=== modified file 'debian/control'
42--- debian/control 2012-09-19 20:32:28 +0000
43+++ debian/control 2014-02-07 01:59:54 +0000
44@@ -2,13 +2,12 @@
45 Section: doc
46 Priority: optional
47 Maintainer: Ubuntu Documentation Team <ubuntu-doc@lists.ubuntu.com>
48-Build-Depends: cdbs,
49- debhelper (>= 8),
50+Build-Depends: debhelper (>= 9),
51 docbook-xml,
52 docbook-xsl,
53 xsltproc,
54 gnome-doc-utils
55-Standards-Version: 3.9.3
56+Standards-Version: 3.9.5
57
58 Package: xubuntu-docs
59 Architecture: all
60
61=== modified file 'debian/rules'
62--- debian/rules 2012-09-18 00:31:15 +0000
63+++ debian/rules 2014-02-07 01:59:54 +0000
64@@ -4,5 +4,5 @@
65 DEB_MAKE_INSTALL_TARGET :=
66 DEB_MAKE_BUILD_TARGET := all
67
68-include /usr/share/cdbs/1/rules/debhelper.mk
69-include /usr/share/cdbs/1/class/makefile.mk
70+%:
71+ dh $@
72
73=== modified file 'desktop-guide/Makefile'
74--- desktop-guide/Makefile 2014-01-07 00:17:08 +0000
75+++ desktop-guide/Makefile 2014-02-07 01:59:54 +0000
76@@ -5,6 +5,15 @@
77 # Xubuntu Docbook Customization Layer
78 XUBUNTUXSL=libs/xubuntu-html-chunk-cust.xsl
79
80+ifneq ($(wildcard po/LINGUAS),)
81+ $(shell ../scripts/translate.sh -u >/dev/null)
82+ OPTS=-g
83+ TRANSLATIONS=$(shell cat po/LINGUAS)
84+else
85+ OPTS=
86+ TRANSLATIONS=$(shell basename -s .po -a po/*po)
87+endif
88+
89 html: style
90 xsltproc --xinclude -o ../build/desktop-guide/index.html $(XUBUNTUXSL) C/index.xml
91
92@@ -15,4 +24,13 @@
93 cp -r libs/admon ../build/libs
94 cp -r libs/navig ../build/libs
95
96-.PHONY: html
97+translate:
98+ ../scripts/translate.sh $(OPTS); \
99+ for dir in $(TRANSLATIONS); do \
100+ xsltproc --xinclude -o ../build/$$dir/index.html $(XUBUNTUXSL) $$dir/index.xml && \
101+ rm -rf $$dir/; \
102+ done
103+
104+clean:
105+ ${RM} -r $(TRANSLATIONS)
106+.PHONY: html translate
107
108=== added file 'desktop-guide/po/LINGUAS'
109--- desktop-guide/po/LINGUAS 1970-01-01 00:00:00 +0000
110+++ desktop-guide/po/LINGUAS 2014-02-07 01:59:54 +0000
111@@ -0,0 +1,3 @@
112+fi
113+pt
114+ru
115
116=== removed file 'scripts/rename-rosetta-po-files.sh'
117--- scripts/rename-rosetta-po-files.sh 2013-05-17 11:53:41 +0000
118+++ scripts/rename-rosetta-po-files.sh 1970-01-01 00:00:00 +0000
119@@ -1,3 +0,0 @@
120-# This script renames po files downloaded from Launchpad into a standard format filename. It works around this bug in Launchpad: https://bugs.launchpad.net/bugs/353981
121-
122-for i in `cat libs/shipped-docs` serverguide ; do cd $i/po ; mv ../*.po . ; for x in ubuntu-docs-$i-*.po ; do echo $x ; mv $x ${x#ubuntu-docs-$i-} ; done ; cd ../../ ; done
123
124=== modified file 'scripts/translate.sh'
125--- scripts/translate.sh 2012-09-18 00:31:15 +0000
126+++ scripts/translate.sh 2014-02-07 01:59:54 +0000
127@@ -1,11 +1,11 @@
128 #!/bin/sh
129
130-####################################################################################
131+####################################################################################
132 # Copyright (C) 2005-2006 Ubuntu Documentation Project (ubuntu-doc@lists.ubuntu.com)
133 # This program is free software; you can redistribute it and/or modify
134 # it under the terms of the GNU General Public License as published by
135 # the Free Software Foundation; either version 2 of the License, or
136-# (at your option) any later version.
137+# (at your option) any later version.
138 #
139 # This program is distributed in the hope that it will be useful,
140 # but WITHOUT ANY WARRANTY; without even the implied warranty of
141@@ -15,7 +15,7 @@
142 # You should have received a copy of the GNU General Public License
143 # along with this program; if not, write to the Free Software
144 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
145-# On Debian based systems a copy of the GPL can be found
146+# On Debian based systems a copy of the GPL can be found
147 # at /usr/share/common-licenses/GPL
148 ####################################################################################
149
150@@ -25,55 +25,64 @@
151 # $ translate.sh
152 #
153 # Optional parameters:
154-# -d<documentname>
155+# -g Translate for every language listed in po/LINGUAS
156 # -l<language>
157+# -u Update the list of translations in po/LINGUAS
158 #
159
160-translate () {
161- y=$(basename ${1} .po)
162- echo " --Translating ${y}"
163- mkdir -p ${y}
164+translate() {
165+ lang=$(basename ${1} .po)
166+ echo " --Translating ${lang}"
167+ mkdir -p ${lang}
168 for i in C/*xml; do
169- j=$(basename ${i} C/)
170- k=$(basename ${j} .xml)
171- xml2po -e -p po/${y}.po C/${j} >${y}/${j}
172+ xml=$(basename ${i} C/)
173+ xml2po -e -p po/${lang}.po C/${xml} >${lang}/${xml}
174 done
175 if [ -e C/${document}-C.omf ]; then
176- xml2po -e -p ${1} C/${document}-C.omf >${y}/${document}-${y}.omf
177- sed -i -e s@\"C\"@\"${y}\"@g -e s@C/@${y}/@g ${y}/${document}-${y}.omf
178+ xml2po -e -p ${1} C/${document}-C.omf >${lang}/${document}-${lang}.omf
179+ sed -i -e s@\"C\"@\"${lang}\"@g -e s@C/@${lang}/@g ${lang}/${document}-${lang}.omf
180 fi
181- ../scripts/validate.sh ${y}/${document}.xml
182+ ../scripts/validate.sh ${lang}/index.xml
183 }
184
185-choose_language () {
186- echo "Entering ${1}"
187- cd ${1}
188- if [ ${2} ]; then
189- translate "po/${2}.po"
190+choose_language() {
191+ if [ ${1} ]; then
192+ translate "po/${1}.po"
193 else
194 for x in po/*.po; do
195 translate ${x}
196 done
197 fi
198- rm .xml2po.mo
199- cd ..
200-}
201-
202-while getopts "d:l:" Option
203+}
204+
205+shipped_languages() {
206+percent=80
207+for po in `ls po/*.po`
208+do
209+ if [ `msgfmt -o /dev/null --statistics $po 2>&1|awk '{printf("%.0f\n",$1 / ($1 + $4 + $7) * 100)}'` -ge "${percent}" ];then
210+ basename -s.po $po
211+ fi
212+done | tee po/LINGUAS
213+exit
214+}
215+
216+while getopts ":gl:u" Option
217 do
218 case ${Option} in
219- d) document=${OPTARG};;
220- l) lang=${OPTARG};;
221+ g) generated=yes;;
222+ l) language=${OPTARG};;
223+ u) shipped_languages;;
224 *) echo "Please specify an argument.";;
225 esac
226 done
227
228-if [ ${document} ]; then
229- choose_language ${document} ${lang}
230+if [ ${language} ]; then
231+ choose_language ${language}
232+elif [ ${generated} ] && [ -f po/LINGUAS ];then
233+ for language in `cat po/LINGUAS`
234+ do
235+ choose_language ${language}
236+ done
237 else
238- for doc in `cat libs/shipped-docs`
239- do
240- choose_language ${doc} ${lang}
241- done
242+ choose_language
243 fi
244-
245
246=== removed file 'scripts/yelptest'
247--- scripts/yelptest 2012-09-18 00:31:15 +0000
248+++ scripts/yelptest 1970-01-01 00:00:00 +0000
249@@ -1,33 +0,0 @@
250-#!/bin/bash
251-
252-####################################################################################
253-# Yelp test script for Ubuntu Topic-based help
254-# Copyright (C) 2006 Ubuntu Documentation Project (ubuntu-doc@lists.ubuntu.com)
255-# This program is free software; you can redistribute it and/or modify
256-# it under the terms of the GNU General Public License as published by
257-# the Free Software Foundation; either version 2 of the License, or
258-# (at your option) any later version.
259-#
260-# This program is distributed in the hope that it will be useful,
261-# but WITHOUT ANY WARRANTY; without even the implied warranty of
262-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
263-# GNU General Public License for more details.
264-#
265-# You should have received a copy of the GNU General Public License
266-# along with this program; if not, write to the Free Software
267-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
268-# On Debian based systems a copy of the GPL can be found
269-# at /usr/share/common-licenses/GPL
270-#
271-####################################################################################
272-
273-document=ubuntu/C/$1/$1.xml
274-if [ -e $document ]
275-then
276- yelp $document
277-elif [ -e $1 ]
278-then
279- yelp $1
280-else
281- echo "Sorry! Document '$document' or file '$1' does not exist."
282-fi

Subscribers

People subscribed via source and target branches