Mikolaj Zalewski : - put an error when an erronous resource is inherited from neutral

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


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

Author: Mikolaj Zalewski <mikolajz at tygrys.dom>
Date:   Sun Mar  2 15:13:36 2008 +0100

- put an error when an erronous resource is inherited from neutral
- how a warning when viewing the Portugese (Neutral) locale

---

 php/lang.php     |    8 ++++++++
 php/lib.php      |   12 ++++++++++++
 php/resfile.php  |    9 ++++++++-
 php/resource.php |    3 ++-
 php/style.css    |   10 ++++++++++
 scripts/ver.pl   |   12 ++++++++++--
 6 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/php/lang.php b/php/lang.php
index fd212a7..008ba45 100644
--- a/php/lang.php
+++ b/php/lang.php
@@ -37,6 +37,11 @@ ksort($partial);
 ksort($notransl);
 ?>
 <html>
+<head>
+    <link rel="stylesheet" href="style.css" type="text/css"/>
+    <title>Language <?php echo get_lang_name($lang) ?> - Wine translations</title>
+</head>
+
 <?php
 function dump_table($table)
 {
@@ -61,6 +66,9 @@ function dump_table($table)
 ?>
 <p><?php dump_menu_root() ?> &gt; <?php dump_menu_lang($lang, FALSE)?> </p>
 <h1><?php echo "Language: ".get_lang_name($lang) ?></h1>
+
+<?php warn_if_lang_hidden($lang) ?>
+
 <h2>Partialy translanted files</h2>
 <?php dump_table($partial) ?>
 
diff --git a/php/lib.php b/php/lib.php
index 336b935..74d3807 100644
--- a/php/lib.php
+++ b/php/lib.php
@@ -79,6 +79,18 @@ function get_lang_binid($lang)
     return hexdec($m[1]) + (hexdec($m[2]) << 10);
 }
 
+/* Make sure people are not suprised if they see Portugese (Neutral) has nearly
+ * no resources */
+function warn_if_lang_hidden($lang)
+{
+    if (has_lang_flag($lang, "hide"))
+    {
+        echo "<p class=\"note\"><b>Note:</b> this is the ".get_lang_name($lang)." locale which\n".
+            "is not supposed to be used directly but only to have some resources\n".
+            "inherited by sublanguages.</p>";
+    }
+}
+
 function get_locale_name($localeid)
 {
     global $LOCALE_NAMES;
diff --git a/php/resfile.php b/php/resfile.php
index 0ed577d..4044d80 100644
--- a/php/resfile.php
+++ b/php/resfile.php
@@ -9,11 +9,18 @@ $file = fopen("$DATAROOT/langs/$lang", "r");
 $msgs = array();
 ?>
 <html>
+<head>
+    <link rel="stylesheet" href="style.css" type="text/css"/>
+    <title>File <?php echo $resfile?> - Wine translations</title>
+</head>
+
 <?php dump_menu_root() ?> &gt <?php dump_menu_lang($lang) ?> &gt <?php dump_menu_resfile($lang, $resfile, FALSE) ?>
 
 <h1>File <?php echo $resfile?></h1>
 
 <?php
+warn_if_lang_hidden($lang);
+
 while ($line = fgets($file, 4096))
 {
     if (preg_match("@$resfile: (.*)@", $line, $m))
@@ -86,4 +93,4 @@ foreach ($msgs as $value)
     echo "</td><td>".$value."</td></tr>\n";
 }
 ?>
-</html>
\ No newline at end of file
+</html>
diff --git a/php/resource.php b/php/resource.php
index e17fbaa..0ed81a4 100644
--- a/php/resource.php
+++ b/php/resource.php
@@ -12,7 +12,8 @@ $compare = isset($_REQUEST['compare']);
 ?>
 <html>
 <head>
-	<link rel="stylesheet" href="style.css" type="text/css"/>
+    <link rel="stylesheet" href="style.css" type="text/css"/>
+    <title><?php echo get_resource_name($type, $id) ?> from <?php echo $resfile?> - Wine translation</title>
 </head>
 <body>
 <?php dump_menu_root() ?> &gt <?php dump_menu_lang($lang) ?> &gt <?php dump_menu_resfile($lang, $resfile) ?> &gt
diff --git a/php/style.css b/php/style.css
index aed2948..ef053ce 100644
--- a/php/style.css
+++ b/php/style.css
@@ -11,3 +11,13 @@
     color: grey;
     font-style: italic;
 }
+
+/* a note e.g. that you are watching a hidden language */
+p.note
+{
+    background-color: #ffff7f;
+    border-width: 2px;
+    border-style: solid;
+    border-color: black;
+    padding: 2px;
+}
\ No newline at end of file
diff --git a/scripts/ver.pl b/scripts/ver.pl
index 05475b4..33ba451 100755
--- a/scripts/ver.pl
+++ b/scripts/ver.pl
@@ -177,8 +177,16 @@ foreach $resource (@resources)
                 }
             } else
             {
-                push @{$notes_rl{$resource}{$lang}}, "Translation inherited from \@LANG($basic_lang)";
-                $transl_count{$lang}++;
+                if (@{$errs_rl{$resource}{$basic_lang}})
+                {
+                    push @{$errs_rl{$resource}{$lang}}, "Translation inherited from \@LANG($basic_lang): translation out of sync";
+                    $err_count{$langs}++;
+                    print "Inheritance error\n";
+                } else
+                {
+                    push @{$notes_rl{$resource}{$lang}}, "Translation inherited from \@LANG($basic_lang)";
+                    $transl_count{$lang}++;
+                }
             }
         }
         else




More information about the wine-cvs mailing list