Translate the WineFAQ to French

Francois Gouget fgouget at codeweavers.com
Tue May 24 19:23:08 CDT 2005


Detlef Riekenberg wrote:
[...]
> This was an out of tree compilation, but with a not really useful
> target-directory (sorry for that. I changed it already, because the
> docs-makefile overwrites the wine makefile).

Ok. I have a patch that fixes the out-of-tree build issue. It relies on 
a fix to po4a so it interprets the path to files included in Sgml as 
relative to the directory of the master Sgml file. IOW, with this patch 
when ../en/wineuser-guide.sgml includes wineusr-introduction.sgml we 
look for ../en/wineuser-introduction.sgml (which is what the other Sgml 
tools like docbook2html seem to do).

I have submitted the patch to the po4a folks and I'm hoping they will 
commit it. I have also attached the patch to this email together with 
the Makefile.in change for review.


-- 
Francois Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: fr/Makefile.in
===================================================================
RCS file: /cvsroot/wine/docs/fr/Makefile.in,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.in
--- fr/Makefile.in	18 May 2005 20:41:07 -0000	1.2
+++ fr/Makefile.in	24 May 2005 17:38:22 -0000
@@ -5,7 +5,6 @@ VPATH     = @srcdir@
 
 LANG      = fr
 SGMLDIR   = $(TOPSRCDIR)/en
-DOCDIR    = $(TOPSRCDIR)/fr
 MIN_TRANS = 1
 
 WINEFAQ_SRCS = \
@@ -22,10 +21,10 @@ all: doc
 updatepo: $(ALLBOOKS:%=%.updatepo)
 
 %.updatepo:
-	cd $(SGMLDIR) && $(PO4AENV) perl $(PO4ADIR)/po4a-updatepo -f sgml -m $*.sgml -p $(DOCDIR)/$*.po
+	$(PO4AENV) perl $(PO4ADIR)/po4a-updatepo -f sgml -m $(SGMLDIR)/$*.sgml -p $(SRCDIR)/$*.po
 
 %.posgml: $(SGMLDIR)/%.sgml %.po
-	cd $(SGMLDIR) && $(PO4AENV) perl $(PO4ADIR)/po4a-translate -v -f sgml -m $*.sgml -p $(DOCDIR)/$*.po -l $(DOCDIR)/$*.posgml -k $(MIN_TRANS)
+	$(PO4AENV) perl $(PO4ADIR)/po4a-translate -v -f sgml -m $(SGMLDIR)/$*.sgml -p $(SRCDIR)/$*.po -l $*.posgml -k $(MIN_TRANS)
 
 %.sgml: %.posgml
 	sed -e 's/^<\(article .*\) lang="en">$$/<\1 lang="$(LANG)">/'  -e 's/^<\(book .*\) lang="en">$$/<\1 lang="$(LANG)">/' $*.posgml >$*.sgml || ($(RM) $*.sgml && false)
Index: po4a/lib/Locale/Po4a/Sgml.pm
===================================================================
RCS file: /cvsroot/wine/docs/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Sgml.pm
--- po4a/lib/Locale/Po4a/Sgml.pm	14 May 2005 12:37:35 -0000	1.1.1.1
+++ po4a/lib/Locale/Po4a/Sgml.pm	24 May 2005 17:38:23 -0000
@@ -290,24 +291,24 @@ sub set_tags_kind {
 # Do the actual work, using the SGMLS package and settings done elsewhere.
 #
 sub parse_file {
-    my ($self,$filename)=@_;
+    my ($self,$mastername)=@_;
     my ($prolog);
 
     # Rewrite the file to:
     #   - protect optional inclusion marker (ie, "<![ %str [" and "]]>")
     #   - protect entities from expansion (ie "&release;")
-    open (IN,"<$filename") 
-	|| die wrap_mod("po4a::sgml", dgettext("po4a", "Can't open %s: %s"), $filename, $!);
+    open (IN,"<$mastername")
+	|| die wrap_mod("po4a::sgml", dgettext("po4a", "Can't open %s: %s"), $mastername, $!);
     my $origfile="";
     while (<IN>) {
 	$origfile .= $_;
     }
-    close IN || die wrap_mod("po4a::sgml", dgettext("po4a", "Can't close %s: %s"), $filename, $!);
+    close IN || die wrap_mod("po4a::sgml", dgettext("po4a", "Can't close %s: %s"), $mastername, $!);
     # Detect the XML pre-prolog
     if ($origfile =~ s/^(\s*<\?xml[^?]*\?>)//) {
 	warn wrap_mod("po4a::sgml", dgettext("po4a",
 		"Trying to handle a XML document as a SGML one. ".
-		"Feel lucky if it works, help us implementing a proper XML backend if it does not."), $filename)
+		"Feel lucky if it works, help us implementing a proper XML backend if it does not."), $mastername)
 	  unless $self->verbose() <= 0;
 	$xmlprolog=$1;
     }
@@ -442,8 +443,8 @@ sub parse_file {
     my @lines = split(/\n/, $origfile);
     print "XX Prepare reference indirection stuff\n" if $debug{'refs'};
     for (my $i=1; $i<=scalar @lines; $i++) {
-	push @refs,"$filename:$i";
-	print "$filename:$i\n" if $debug{'refs'};
+	push @refs,"$mastername:$i";
+	print "$mastername:$i\n" if $debug{'refs'};
     }
 
     # protect the conditional inclusions in the file
@@ -465,6 +466,12 @@ sub parse_file {
 	    my $key = $2;
 	    my $filename=$3;
 	    $prolog = $1.$4;
+            if ($filename !~ m%/%)
+            {
+                my $dir=$mastername;
+                $dir =~ s%/[^/]*$%%;
+                $filename="$dir/$filename";
+            }
 	    (-e $filename && open IN,"<$filename")  ||
 	      die wrap_mod("po4a::sgml", dgettext("po4a", "Can't open %s (content of entity %s%s;): %s"),
 		  $filename, '%', $key, $!);
@@ -517,6 +524,12 @@ sub parse_file {
 	my $key = $2;
 	my $filename = $3;
 	$searchprolog = $1.$4;
+        if ($filename !~ m%/%)
+        {
+            my $dir=$mastername;
+            $dir =~ s%/[^/]*$%%;
+            $filename="$dir/$filename";
+        }
 	$entincl{$key}{'filename'}=$filename;
 	# Preload the content of the entity
 	(-e $filename && open IN,"<$filename")  ||
@@ -575,7 +589,7 @@ sub parse_file {
     if ($debug{'refs'}) {
 	print "XX Resulting shifts\n";
 	for (my $i=0; $i<scalar @refs; $i++) {
-	    print "$filename:".($i+1)." -> $refs[$i]\n";
+	    print "$mastername:".($i+1)." -> $refs[$i]\n";
 	}
     }
     


More information about the wine-devel mailing list