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

Re: translating documentation and putting it on the web server



On Thu, Jan 18, 2001 at 11:46:13PM +0100, Josip Rodin wrote:
> On Thu, Jan 18, 2001 at 11:56:51AM +0100, Martin Quinson wrote:
> 
> > - offer the translations from the same pages (using content negociation ?
> >   using more than one link ?)
> 
> That would be nice, but it's kinda tricky since not all default makefiles
> also build the translations, and finding out if any translations exist in
> the .wml would require quite a bit of tweaking...

Here is a patch against the makefile of maint-guide. It makes it install the
translated versions of html pages, and then, content negociation works for
me (TM).

The most awfull change is that it requiers to rename maint-guide.sgml to
maint-guide.en.sgml (what seems pretty logic).

The tricky part is because debiandoc2html is a bit broken. For -l pt_BR, it
makes files named name.pt-br.html , what is obiously wrong, and prevent
apache to serve theses pages when pt_BR is asked. So we have to fix the file
names after generation.

I think what is done for html could be easily extended to txt and ps. and
all this may be extended to others directories.

Any comments ? This patch won't hurt any thing as I can't apply it ;)

Bye, Mt.
--- Makefile.old	Fri Jan 19 09:46:50 2001
+++ Makefile	Fri Jan 19 11:29:53 2001
@@ -6,38 +6,43 @@
 
 # this can and will be overriden by a higher level makefile
 PUBLISHDIR := ../../../public_html/manuals.html
+MANUALNAME = maint-guide
+LANGS=$(shell ls $(MANUALNAME).*.sgml|sed 's/.*$(MANUALNAME)\.\([^.]*\)\.sgml/\1/')
 
 all: html txt ps
 
 # generating HTML
-html: $(patsubst %.sgml,%.html/index.html,$(wildcard *.sgml))
+html: $(foreach lang,$(LANGS),$(MANUALNAME).$(lang).html)
 
-maint-guide.html/index.html: maint-guide.sgml
-	debiandoc2html $<
-
-maint-guide.%.html/index.html: maint-guide.%.sgml
-	debiandoc2html -l $* $<
+maint-guide.%.html: maint-guide.%.sgml
+	debiandoc2html -l $* -c $<
+	for file in `ls $(MANUALNAME).$*.html/*` ; do\
+	  newfile=`echo $$file|sed 's/$(shell echo $*|sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/')\.html/$*\.html/'`;\
+	  if [ $$file != $$newfile ] ; then\
+	    mv $$file $$newfile;\
+	  fi\
+	done;	
 
 # generating plain text
 txt text: $(patsubst %.sgml,%.txt,$(wildcard *.sgml))
 
 maint-guide.txt: maint-guide.sgml
-	debiandoc2text $<
+	debiandoc2text -l en -c $<
 
 maint-guide.%.txt: maint-guide.%.sgml
-	debiandoc2text -l $* $<
+	debiandoc2text -l $* -c $<
 
 # generating PostScript
 ps: maint-guide.ps
 
 maint-guide.ps: maint-guide.sgml
-	debiandoc2latexps $<
+	debiandoc2latexps -l en -c $<
 
 # publishing to the DDP web pages
-publish: maint-guide.html/index.html
+publish: html
 	test -d $(PUBLISHDIR)/maint-guide || install -d -m 755 $(PUBLISHDIR)/maint-guide
 	rm -f $(PUBLISHDIR)/maint-guide/*.html
-	install -p -m 644 maint-guide.html/*.html $(PUBLISHDIR)/maint-guide/
+	@$(foreach lang,$(LANGS),echo "installing lang $(lang)";install -p -m 644 maint-guide.$(lang).html/*.$(lang).html $(PUBLISHDIR)/maint-guide/;)
 
 # validating SGML
 validate:

Reply to: