Michael Stefaniuc : transl: Add more kernel32/nls empty string exceptions.

Alexandre Julliard julliard at winehq.org
Tue Apr 20 10:50:19 CDT 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Tue Apr 20 02:36:43 2010 +0200

transl: Add more kernel32/nls empty string exceptions.

- LOCALE_SPOSITIVESIGN, LOCALE_SMONTHNAME13 and LOCALE_SABBREVMONTHNAME13
  are empty in English (US) but can be set in the translations. This
  fixes the false positive in the Syriac translation.
- Empty LOCALE_S1159 and LOCALE_S2359 aren't warnings either. This
  removes a few pedantic warnings for missing AM/PM strings.

---

 transl/parse_resfiles.php |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/transl/parse_resfiles.php b/transl/parse_resfiles.php
index a6ec479..ac62342 100644
--- a/transl/parse_resfiles.php
+++ b/transl/parse_resfiles.php
@@ -157,18 +157,32 @@ function res_callback($header, $file)
         $errwarncount[$langid][$resource] = $basic_res->getcounts($master_res);
 
         // A .rc file can contain empty strings (""). There is however no distinction in a
-        // resource file between empty strings and missing ones. The following is the only
+        // resource file between empty strings and missing ones. The following are the only
         // exception to the rule that a translation should exist for strings that are
-        // available in English (United States).
-        if (($resdir == "dlls/kernel32") && ($header["type"] == 6) && ($header["name"] == 3))
+        // available in English (United States) and vice versa.
+        if (($resdir == "dlls/kernel32") && ($header["type"] == 6))
         {
-            // LOCALE_S1159 and LOCALE_S2359 can be empty and are to be ignored as errors
-            $LOCALE_S1159 = $basic_res->GetString(8);
-            $LOCALE_S2359 = $basic_res->GetString(9);
-            if (!$LOCALE_S1159)
-                $errwarncount[$langid][$resource]['errors']--;
-            if (!$LOCALE_S2359)
-                $errwarncount[$langid][$resource]['errors']--;
+            // STRINGTABLE => (string_pos => (empty=0 or non-empty=1), ...)
+            $exceptions = array(
+                                3 => array( 8 => 0,     // LOCALE_S1159
+                                            9 => 0),    // LOCALE_S2359
+                                6 => array( 0 => 1),    // LOCALE_SPOSITIVESIGN
+                              257 => array(14 => 1,     // LOCALE_SMONTHNAME13
+                                           15 => 1)     // LOCALE_SABBREVMONTHNAME13
+                               );
+
+            if (array_key_exists($header["name"], $exceptions))
+            {
+                foreach ($exceptions[$header["name"]] as $string_pos => $expect)
+                {
+                    $string = $basic_res->GetString($string_pos);
+                    if (!!$string == $expect)
+                    {
+                        $errwarncount[$langid][$resource]['errors']--;
+                        $errwarncount[$langid][$resource]['warnings']--;
+                    }
+                }
+            }
         }
     }
 




More information about the wine-cvs mailing list