[translations] new extractor, should work on Windows

Morten Wulff wulff at ratatosk.net
Thu Feb 2 07:32:00 UTC 2006


Gabor Hojtsy wrote:
> Today I committed several improvements to the translation template
> generator. These include:
-snip description-

Thanks! This a big improvement for those of us stuck on windows :-) (My 
.bat file to call extractor was getting a bit messy.)

> It was never easier to run the extractor. Please try on Windows, I don't
> have a Windows system here, so I cannot do it myself.

Testing with PHP 5.1.1 on WinXP, I get the following error when running 
extractor.php in the root of the Drupal directory:

Fatal error: Call to undefined function write_header() in 
D:\projekter\drupal\drupal-HEAD\extractor.php on line 167

As far as I can tell, the "if (!function_exists("write_header"))" block 
is never run. The attached diff fixes the problem for me, but it can 
probably be solved a little more elegantly.


Med venlig hilsen / Kind regards,

Morten Wulff


-- 
Self Injury Information and Support: http://www.psyke.org/

"I did not, you see, want to kill myself. Not at that time, anyway. But
I wanted to know that if need be, if the desperation got so terribly
bad, I could inflict harm on my body. And I could." - Elizabeth Wurtzel
-------------- next part --------------
Index: translations/drupal-pot/extractor.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/translations/drupal-pot/extractor.php,v
retrieving revision 1.9
diff -u -r1.9 extractor.php
--- translations/drupal-pot/extractor.php	1 Feb 2006 20:51:28 -0000	1.9
+++ translations/drupal-pot/extractor.php	2 Feb 2006 07:29:49 -0000
@@ -163,6 +163,31 @@
        $storage[$file][] = $input;
       }
       else {
+        // You can override the header (with a language team specific variant for example),
+        // if you generate missing templates for yourself, and would like to work quickly.
+        if (!function_exists("write_header")) {
+        function write_header($file) {
+          $output  = "# LANGUAGE translation of Drupal (". $file .")\n";
+          $output .= "# Copyright YEAR NAME <EMAIL at ADDRESS>\n";
+          $output .= "# --VERSIONS--\n";
+          $output .= "#\n";
+          $output .= "#, fuzzy\n";
+          $output .= "msgid \"\"\n";
+          $output .= "msgstr \"\"\n";
+          $output .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n";
+          $output .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
+          $output .= "\"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\\n\"\n";
+          $output .= "\"Last-Translator: NAME <EMAIL at ADDRESS>\\n\"\n";
+          $output .= "\"Language-Team: LANGUAGE <EMAIL at ADDRESS>\\n\"\n";
+          $output .= "\"MIME-Version: 1.0\\n\"\n";
+          $output .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
+          $output .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
+          $output .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n\n";
+
+          return $output;
+        }
+        }
+
         $storage[$file] = array();
         $storage[$file][0] = write_header($file);
         $storage[$file][1] = $filelist;
@@ -174,31 +199,6 @@
     }
   }

-  // You can override the header (with a language team specific variant for example),
-  // if you generate missing templates for yourself, and would like to work quickly.
-  if (!function_exists("write_header")) {
-  function write_header($file) {
-    $output  = "# LANGUAGE translation of Drupal (". $file .")\n";
-    $output .= "# Copyright YEAR NAME <EMAIL at ADDRESS>\n";
-    $output .= "# --VERSIONS--\n";
-    $output .= "#\n";
-    $output .= "#, fuzzy\n";
-    $output .= "msgid \"\"\n";
-    $output .= "msgstr \"\"\n";
-    $output .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n";
-    $output .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
-    $output .= "\"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\\n\"\n";
-    $output .= "\"Last-Translator: NAME <EMAIL at ADDRESS>\\n\"\n";
-    $output .= "\"Language-Team: LANGUAGE <EMAIL at ADDRESS>\\n\"\n";
-    $output .= "\"MIME-Version: 1.0\\n\"\n";
-    $output .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
-    $output .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
-    $output .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n\n";
-
-    return $output;
-  }
-  }
-
   function format_quoted_string($str) {
     $quo = substr($str, 0, 1);
     $str = substr($str, 1, -1);


More information about the translations mailing list