Mikolaj Zalewski : - name correctly the languages when inheriting the resource

Alexandre Julliard julliard at winehq.org
Fri Jun 19 08:36:18 CDT 2009


Module: tools
Branch: master
Commit: c6c1a183e1f1976e5cd5cf9164be0b21f7bcd592
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=c6c1a183e1f1976e5cd5cf9164be0b21f7bcd592

Author: Mikolaj Zalewski <mikolajz at tygrys.dom>
Date:   Sat Mar  1 21:13:52 2008 +0100

- name correctly the languages when inheriting the resource
- make a correct link to the resource that was inherited
- don't touch conf/$locale when showing locale stringtables

---

 php/lib.php     |    6 ++++--
 php/resfile.php |   10 +++++++++-
 scripts/ver.pl  |    2 +-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/php/lib.php b/php/lib.php
index 9b17c2b..e4e0e56 100644
--- a/php/lib.php
+++ b/php/lib.php
@@ -8,7 +8,7 @@ function validate_lang($id)
 {
     global $DATAROOT;
     
-    $lang = preg_replace("/[^0-9a-f:]/", "-", $_REQUEST['lang']);
+    $lang = preg_replace("/[^0-9a-f:]/", "-", $id);
     if (!file_exists("$DATAROOT/conf/$lang") || !file_exists("$DATAROOT/langs/$lang"))
         die("Invalid lang parameter");
     return $lang;
@@ -50,7 +50,7 @@ function get_raw_lang_name($id)
 
 function get_lang_name($id)
 {
-    return preg_replace("/\[ignore-sublang\]/", "", get_raw_lang_name($id));
+    return preg_replace("/\[[A-za-z0-9-]+\]/", "", get_raw_lang_name($id));
 }
 
 function get_lang_base($id)
@@ -65,6 +65,8 @@ function has_lang_flag($id, $flag)
 
 function is_lang_ignore_sublang($lang)
 {
+    if (!preg_match("/:00/", $lang))
+        return FALSE;
     return has_lang_flag($lang, "ignore-sublang");
 }
 
diff --git a/php/resfile.php b/php/resfile.php
index e4eb7ad..402808b 100644
--- a/php/resfile.php
+++ b/php/resfile.php
@@ -41,13 +41,21 @@ foreach ($msgs as $value)
     if (isset($icon))
         echo "<img src=\"img/icon-".$icon."\" width=\"32\">";
 
+    $line_lang = $lang;
+    if (preg_match("/@LANG\(([0-9a-f]{3}:[0-9a-f]{2})\)/", $value, $m))
+    {
+        validate_lang($m[1]);
+        $line_lang = $m[1];
+        $value = preg_replace("/@LANG\(([0-9a-f]{3}:[0-9a-f]{2})\)/", get_lang_name($m[1]), $value);
+    }
+
     if (preg_match("/@RES\(([^:\)]+):([^:\)]+)\)/", $value, $m))
     {
         if (is_dumpable_type($m[1]) && (strpos($value, "Missing: ") !== 0))
         {
             $error = (strpos($value, "Error: ") === 0);
             $value = preg_replace("/@RES\(([^:\)]+):([^:\)]+)\)/", 
-                gen_resource_a($lang, $resfile, $m[1], $m[2], $error).
+                gen_resource_a($line_lang, $resfile, $m[1], $m[2], $error).
                 get_resource_name($m[1], $m[2])."</a>",
                 $value);
         }
diff --git a/scripts/ver.pl b/scripts/ver.pl
index a80f6fa..05475b4 100755
--- a/scripts/ver.pl
+++ b/scripts/ver.pl
@@ -177,7 +177,7 @@ foreach $resource (@resources)
                 }
             } else
             {
-                push @{$notes_rl{$resource}{$lang}}, "Translation inherited from $basic_lang";
+                push @{$notes_rl{$resource}{$lang}}, "Translation inherited from \@LANG($basic_lang)";
                 $transl_count{$lang}++;
             }
         }




More information about the wine-cvs mailing list