[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesdk/scripts
From:       Waldo Bastian <bastian () kde ! org>
Date:       2005-01-06 16:23:06
Message-ID: 20050106162306.199601BB72 () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

Add support for i18n contexts in *.rc files


  M +11 -3     extractrc   1.40


--- kdesdk/scripts/extractrc  #1.39:1.40
@@ -67,5 +67,5 @@
 my $tags = TAG_GROUP->{$opt_tag_group};
 my $extra_tags  = join "", map "|" . quotemeta, @opt_extra_tags;
-my $text_string = qr/($tags$extra_tags)>/;                       # Precompile regexp
+my $text_string = qr/($tags$extra_tags)( [^>]*)?>/;    # Precompile regexp
 
 
@@ -87,4 +87,7 @@
   my $start_line_no   = 0;
   my $in_skipped_prop = 0;
+  my $tag = "";
+  my $attr = "";
+  my $context = "";
 
   while ( <$fh> )
@@ -108,8 +111,13 @@
      }
 
+     $context = $opt_context;
+
      unless ( $in_skipped_prop or $in_text )
      {
-       if ( $string =~ /<$text_string/o )
+       if ( ($tag, $attr) = $string =~ /<$text_string/o )
        {
+         ($attr) = $attr =~ /\w*context=\"([^\"]*)\"/ if $attr;
+         $context = $attr if $attr;
+
          $string        =~ s/^.*<$text_string//so;
          $in_text       =  1;
@@ -143,5 +151,5 @@
        print "// xgettext: no-c-format\n";
        print  q|i18n("|;
-       print qq|$opt_context","|        if $opt_context;   # We have a I18N context
+       print qq|$context","|        if $context;   # We have a I18N context
        print qq|$text");\n|;
      }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic