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

Re: new translator section in debian::weeklynews::footer



Beautiful night mon 23. jun 2003 23:46, I wrote:
> I was thinking about adding to d::w::footer another section, I mean
> translator(s). Very often DWN is translated by someone, who would like his
> name mentioned, especially if he doesn't translate ordinary Debian webpages
> but only DWN.
> If no protests, I can do it, it would look much like editor(s) section.
As I haven't noticed any protests, I send You a patch to comment.
One thing interests me. You run it just as editor, it means:
#use debian::weeklynews::footer translator="Mr. Foo the Foot<foot@foo.com>"
And it should produce
bla...bla..bla... <a href="mailto:foot@foo.com";>Mr. Foo the Foot</a>.
but it makes
bla...bla...bla...<a href="mailto:foo.com";>Mr.Foo the Foot</a>.
This is of course wrong. I don't know where it loses "@". Right now You can 
just write:
Mr. Foo the Foot<foot(at)foo.com> and (at) will be converted later to @.
Any hints how to fix it? I won't commit it now, hope someone has got a clue :)
Greetings
Marek "TamCaP" Łaska, PL
PS. Plural translators also possible, just separate them by a comma
PPS. I have also added polish version of the list. OK with it?
--- footer.wml	Wed Jun 18 17:39:38 2003
+++ footer_m.wml	Tue Jun 24 22:20:14 2003
@@ -18,6 +18,77 @@
   <gettext><void id="plural" />Debian Weekly News is edited by <a href="mailto:dwn@debian.org";>%s</a>.</gettext>
 </define-tag>
 
+<define-tag translator_singular whitespace=delete>
+# One translator only
+  <gettext><void id="singular" />This Debian Weekly News was translated by %s.</gettext>
+</define-tag>
+
+<define-tag translator_plural whitespace=delete>
+# Two ore more translators
+  <gettext><void id="plural" />This Debian Weekly News was translated by %s.</gettext>
+</define-tag>
+
+<define-tag translator whitespace=delete>
+<:{
+   my $translator = "$(translator)";
+   my $plural = 0;
+   my $email = "";
+   my $name = "";
+   my $translators = "";
+   my $last = 0;
+   my $p =0;
+   if (length ($translator)) {
+      $translator =~ s/\(at\)/@/;
+      $plural = 1 if $translator =~ /,/;
+   do {
+   $email="";
+   $name="";
+   $translators=$translators.", " unless ($last == 0);
+   $p = index($translator,"<",$last);
+   $email = substr($translator,$p+1,index($translator,">",$p)-($p+1)) unless (index($translator,">",$p)==-1);
+   $name = substr($translator,$last,$p-$last);
+   if (length ($email)){
+   $translators = $translators.'<a href="mailto:'.$email.'">'."$name</a>";
+   }else{$translators = $name;}
+   $last = index($translator,",",$last+1);
+   }until ($last == -1);
+   if ($CUR_ISO_LANG eq 'en') {
+     $translators =~ s/,([^,]+)$/ and $1/;
+     $translators =~ s/,/, /g;
+   } elsif ($CUR_ISO_LANG eq 'de') {
+     $translators =~ s/,([^,]+)$/ und $1/;
+     $translators =~ s/,/, /g;
+   } elsif ($CUR_ISO_LANG eq 'sv') {
+     $translators =~ s/,([^,]+)$/ och $1/;
+     $translators =~ s/,/, /g;
+     $translators =~ s/'/"/g;
+   } elsif ($CUR_ISO_LANG eq 'no' || $CUR_ISO_LANG eq 'da') {
+     $translators =~ s/,([^,]+)$/ og $1/;
+     $translators =~ s/,/, /g;
+   } elsif ($CUR_ISO_LANG eq 'hr') {
+     $translators =~ s/,([^,]+)$/ i $1/;
+     $translators =~ s/,/, /g;
+     $translators =~ s/'/"/g;
+   } elsif ($CUR_ISO_LANG eq 'fr') {
+     $translators =~ s/,([^,]+)$/ et $1/;
+     $translators =~ s/,/, /g;
+     $translators =~ s/'([^',]+)'/Ť $1 ť/g;
+   } elsif ($CUR_ISO_LANG eq 'ru') {
+     $translators =~ s/,([^,]+)$/ É $1/;
+     $translators =~ s/,/, /g;
+   } elsif ($CUR_ISO_LANG eq 'pl') {
+     $translators =~ s/,([^,]+)$/ i $1/;
+     $translators =~ s/,/, /g;
+   } else {
+     # Fallback to the english style if there's no translation yet
+     $translators =~ s/,([^,]+)$/ and $1/;
+     $translators =~ s/,/, /g;
+   }
+   printf q{<translator_singular>}, $translators unless $plural;
+   printf q{<translator_plural>}, $translators if $plural;}
+}:>
+</define-tag>
+
 <define-tag editor whitespace=delete>
 <:{
    my $editor = "$(editor)";
@@ -78,6 +149,9 @@
    } elsif ($CUR_ISO_LANG eq 'ru') {
      $editor =~ s/,([^,]+)$/ É $1/;
      $editor =~ s/,/, /g;
+   } elsif ($CUR_ISO_LANG eq 'pl') {
+     $editor =~ s/,([^,]+)$/ i $1/;
+     $editor =~ s/,/, /g;
    } else {
      # Fallback to the english style if there's no translation yet
      $editor =~ s/,([^,]+)$/ and $1/;
@@ -100,3 +174,4 @@
 
 <p>
 <editor/>
+<br><translator/>

Reply to: