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

Re: %translation_notes



* Gerfried Fuchs <alfie@ist.org> [2002-11-14 15:23]:
>  This is how far I got, please find attached the diff.

 And now please find attached the correct diff.  I will commit it if
noone objects.

 What really happens here:  wmlxgettext.pl didn't care for the set
domains.  It simply extracted all strings from the files it was given as
arguments.  That ended up in far too many strings in each domain, and
even in duplicated strings in the ports.pot and templates.pot files.

 To eliminate that I've added a pattern that extracts the domain and
checks that with the domain we are working on.  If they don't fit the
string will be ignored now.  Please notice also that the default domain
templates will also be considered.

 I see no harm, translation still work (have checked with german).  But
you have the chance to hold me back, of course.

 So long,
Alfie
-- 
Nachdem es SuSE nun endlich geschafft hat, Linux so sehr zu verunstalten, daß
es schlechter als Windows ist, bootet es nun also sogar schon auf der Hardware
von Microsoft.
 -- realborg zu <http://futurezone.orf.at/futurezone.orf?read=detail&id=129360>
Index: wmlxgettext.pl
===================================================================
RCS file: /cvs/webwml/webwml/english/po/wmlxgettext.pl,v
retrieving revision 1.3
diff -u -r1.3 wmlxgettext.pl
--- wmlxgettext.pl	5 Nov 2002 21:56:35 -0000	1.3
+++ wmlxgettext.pl	14 Nov 2002 15:01:34 -0000
@@ -8,6 +8,8 @@
 my $messages = {};
 my @msgids = ();
 
+my $domain = shift @ARGV;
+
 sub escape {
         my $text = shift;
         $text =~ s/\\/\\\\/g;
@@ -42,10 +44,15 @@
         #  Remove comments if they contain <gettext> or </gettext>
         $text =~ s/^[ \t]*#.*<\/?gettext\b//mg;
         $lineno = 1;
-        while ($text =~ m{\G(.*?)(<gettext\b[^>]*>)(.*?)</gettext>}gs) {
-                $msgid = escape($3);
+        while ($text =~ m{\G(.*?)(<gettext\b(?:\s+domain="([^"]+)")?[^>]*>)(.*?)</gettext>}gs) { # " -- to fix vim syntax hilighting :)
+                $msgid = escape($4);
                 $lineno += countNewline ($1.$2);
-                $nextlineno = countNewline ($3);;
+                $nextlineno = countNewline ($4);;
+                my $dom = ($3) ? $3 : 'templates';
+                if ($domain ne $dom) {
+                   $lineno += $nextlineno;
+                   next;  # wrong domain
+                }
                 $comment = '';
                 if ($1 =~ m/(((^|\n)[ \t]*#.*)+)\n?[^\n]*$/) {
                         $comment = $1;
Index: Makefile
===================================================================
RCS file: /cvs/webwml/webwml/english/po/Makefile,v
retrieving revision 1.31
diff -u -r1.31 Makefile
--- Makefile	5 Nov 2002 22:16:41 -0000	1.31
+++ Makefile	14 Nov 2002 15:01:34 -0000
@@ -36,7 +36,7 @@
   ddp.wml events_common.wml fixes_link.wml footer.wml languages.wml \
   links.tags.wml mirrors.wml news.wml recent_list.wml security_tags.wml \
   todoitem.wml translation-check.wml url.wml votebar.wml \
-  weeklynews/footer.wml)
+  weeklynews/footer.wml) $(ENGLISHDIR)/devel/website/tc.data
 
 POTFILES = $(addprefix $(ENGLISHDIR)/po/,$(addsuffix .pot,$(DOMAINS)))
 MOFILES = $(addsuffix .mo,$(DOMAINS))
@@ -51,37 +51,37 @@
 endif
 
 $(ENGLISHDIR)/po/templates.pot: # $(templates_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(templates_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl templates $(templates_FILES) > $@
 
 $(ENGLISHDIR)/po/bugs.pot: # $(bugs_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(bugs_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl bugs $(bugs_FILES) > $@
 
 $(ENGLISHDIR)/po/countries.pot: # $(countries_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(countries_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl countries $(countries_FILES) > $@
 
 $(ENGLISHDIR)/po/doc.pot: # $(doc_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(doc_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl doc $(doc_FILES) > $@
 
 $(ENGLISHDIR)/po/l10n.pot: # $(l10n_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(l10n_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl l10n $(l10n_FILES) > $@
 
 $(ENGLISHDIR)/po/langs.pot: # $(langs_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(langs_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl langs $(langs_FILES) > $@
 
 $(ENGLISHDIR)/po/organization.pot: # $(organization_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(organization_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl organization $(organization_FILES) > $@
 
 $(ENGLISHDIR)/po/ports.pot: # $(ports_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(ports_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl ports $(ports_FILES) > $@
 
 $(ENGLISHDIR)/po/search.pot: # $(search_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(search_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl search $(search_FILES) > $@
 
 $(ENGLISHDIR)/po/vendors.pot: # $(vendors_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(vendors_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl vendors $(vendors_FILES) > $@
 
 $(ENGLISHDIR)/po/others.pot: # $(others_FILES)
-	$(ENGLISHDIR)/po/wmlxgettext.pl $(others_FILES) > $@
+	$(ENGLISHDIR)/po/wmlxgettext.pl others $(others_FILES) > $@
 
 %.mo: %.$(LANGUAGE).po $(ENGLISHDIR)/po/%.pot
 	msgmerge -q $*.$(LANGUAGE).po $(ENGLISHDIR)/po/$*.pot |\

Attachment: pgpru935ssMEZ.pgp
Description: PGP signature


Reply to: