Re: Patch for gnomemm-website



oops, I forgot attach the patch in the last mail. Here it is.

On Fri, Mar 11, 2011 at 12:50 PM, Tao Wang <dancefire gmail com> wrote:
Hi,

I found there are 2 more languages translated for the gtkmm website, however, they are not on the website.

After checkout  gnomemm-website, I found it looks like the Makefile.am is not working correctly, such as only generate html pages for 'de', rather than other languages. And I also realize adding a new language is not as easy as I thought.

So, I modified docs/Makefile.am to fix the bug and made the code more generic. Now, it only need to modify DOC_LINGUAS to add a new language to Makefile.am.

I also add 'Español' to the language list as alphabet order.

If it still not generate files for some languages, please 'make maintainer-clean', then './autogen.sh && make' again. It should be fine now.

--
Regards

Tao Wang



--
Regards

Tao Wang
From dc50b677491ef58e1080f0906bf41d902a9d53e3 Mon Sep 17 00:00:00 2001
From: Tao Wang <dancefire gmail com>
Date: Fri, 11 Mar 2011 12:31:57 +1100
Subject: [PATCH] 	Fix Makefile.am and make it easier to add a new language

	docs/C/gnomemm-website.xml: Add language 'es' and to the language list, and sort the list.
	docs/Makefile.am: Fix the problem of generate html pages for 'es' and 'zh_CN'. And made the code more generic, so if someone want to add a new language to Makefile.am, the only thing need to do is add the language to DOC_LINGUAS.
---
 docs/C/gnomemm-website.xml |    7 +++++--
 docs/Makefile.am           |   39 ++++++++++++++++-----------------------
 2 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/docs/C/gnomemm-website.xml b/docs/C/gnomemm-website.xml
index b18a791..4a6a449 100644
--- a/docs/C/gnomemm-website.xml
+++ b/docs/C/gnomemm-website.xml
@@ -62,13 +62,16 @@
         <title>Language</title>
         <para><itemizedlist>
             <listitem>
+              <para><ulink url="../de/index.html">Deutsch</ulink></para>
+            </listitem>
+            <listitem>
               <para><ulink url="../en/index.html">English</ulink></para>
             </listitem>
             <listitem>
-              <para><ulink url="../zh_CN/index.html">中文</ulink></para>
+              <para><ulink url="../es/index.html">Español</ulink></para>
             </listitem>
             <listitem>
-              <para><ulink url="../de/index.html">Deutsch</ulink></para>
+              <para><ulink url="../zh_CN/index.html">中文</ulink></para>
             </listitem>
           </itemizedlist></para>
       </formalpara>
diff --git a/docs/Makefile.am b/docs/Makefile.am
index cc8893c..39b12a3 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -32,9 +32,8 @@ DOC_INCLUDES = \
 
 DOC_LINGUAS = de es zh_CN
 
-MAINTAINERCLEANFILES =  html/en/*.html $(srcdir)/html/en/*.html	\
-			html/zh_CN/*.html $(srcdir)/html/zh_CN/*.html	\
-			html/de/*.html $(srcdir)/html/de/*.html
+MAINTAINERCLEANFILES =  $(foreach lang,en $(DOC_LINGUAS),html/$(lang)/*.html) \
+			$(foreach lang,en $(DOC_LINGUAS),$(srcdir)/html/$(lang)/*.html)
 
 tutorialdir         = $(gnomemmwebsite_docdir)/tutorial
 tutorial_htmldir    = $(tutorialdir)/html
@@ -46,7 +45,8 @@ tutorial_html_inst  = $(foreach\
 	file,$(tutorial_html_files),$(or $(wildcard $(file)),$(srcdir)/$(file)))
 
 tutorial_xml_files  = $(addsuffix /gnomemm-website.xml,C $(DOC_LINGUAS))
-tutorial_po_files   = $(foreach lang,$(lang)/$(lang).po,$(DOC_LINGUAS))
+tutorial_po_files   = $(foreach lang, $(DOC_LINGUAS), $(lang)/$(lang).po)
+website_indexes	    = $(foreach lang,$(DOC_LINGUAS),html/$(lang)/index.html)
 
 dist_noinst_DATA =		\
 	C/gnomemm-website.xml	\
@@ -60,31 +60,24 @@ dist_tutorial_icons_DATA =
 
 include $(top_srcdir)/build/gnome-doc-utils.make
 
-all-local: $(DOC_LINGUAS) $(addsuffix /gnomemm-website.xml,C $(DOC_LINGUAS)) html/en/index.html html/zh_CN/index.html html/de/index.html
-
-$(DOC_LINGUAS):
+$(DOC_LINGUAS): %: 
 	@$(MKDIR_P) $@
 
+all-local: $(DOC_LINGUAS) html/en/index.html $(website_indexes)
+
+$(website_indexes): html/%/index.html:$(addprefix %/,$(doc_module_with_ext) $(DOC_INCLUDES))
+  lang=$(subst html/,,$(subst /index.html,,$@))
+	$(AM_V_at)rm -rf html/$(lang)
+	$(AM_V_at)$(MKDIR_P) html/$(lang)
+	$(AM_V_GEN)$(XSLTPROC) -o html/$(lang)/ --xinclude param.xsl $(srcdir)/$(lang)/$(doc_module_with_ext)
+
 # Create a html generation of the C locale's version of the DocBook,
 # using our custom stylesheet and graphics:
 html/en/index.html: $(addprefix $(srcdir)/C/,$(doc_module_with_ext) $(DOC_INCLUDES))
-  thelocale=en
-	$(AM_V_at)rm -fr html/$(thelocale)
-	$(AM_V_at)$(MKDIR_P) html/$(thelocale)
+	$(AM_V_at)rm -fr html/en
+	$(AM_V_at)$(MKDIR_P) html/en
 	$(AM_V_GEN)$(XSLTPROC) -o html/en/ --xinclude param.xsl $(srcdir)/C/$(doc_module_with_ext)
-
-html/zh_CN/index.html: $(addprefix $(srcdir)/zh_CN/,$(doc_module_with_ext) $(DOC_INCLUDES))
-  thelocale=zh_CN
-	$(AM_V_at)rm -fr html/$(thelocale)
-	$(AM_V_at)$(MKDIR_P) html/$(thelocale)
-	$(AM_V_GEN)$(XSLTPROC) -o html/$(thelocale)/ --xinclude param.xsl $(srcdir)/$(thelocale)/$(doc_module_with_ext)
-
-html/de/index.html: $(addprefix $(srcdir)/de/,$(doc_module_with_ext) $(DOC_INCLUDES))
-  thelocale=de
-	$(AM_V_at)rm -fr html/$(thelocale)
-	$(AM_V_at)$(MKDIR_P) html/$(thelocale)
-	$(AM_V_GEN)$(XSLTPROC) -o html/$(thelocale)/ --xinclude param.xsl $(srcdir)/$(thelocale)/$(doc_module_with_ext)
-
+	
 validate: $(addprefix $(srcdir)/C/,$(doc_module_with_ext) $(DOC_INCLUDES))
 	$(XMLLINT) --xinclude --postvalid --noout $<
 
-- 
1.7.2.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]