Hi,
Today I committed several improvements to the translation template generator. These include:
- new automatic file discovery (no need to pass all parsed filenames directly) [control freaks can still use the old mode with the --files option]
- speedier operation: now uses a lot less memory, and a lot less computational power, due to some trivial optimisations
Previously people complained that the extractor is not easy to run on Windows due to the command line nature of how file names were passed in. Actually I did not fix this issue intentionally, I discovered that the previously suggested file wildcards were missing some important files, and only ugly wildcards would have helped. Anway, now the extractor autodiscovers files starting from the current working directory, so it should work out of the box for Windows users.
Now those following the PHP.net manual setup suggestions on Windows (ie. they have the php.exe on PATH), should be able to run
php extractor.php
in their drupal folder (given they copy extractor.php there), and get all the translation templates. Extractor.php itself will be excluded from the source files, when generating the templates. This can be easily done with any contrib project too.
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.
BTW I also posted updated templates generated with this new script. There were quite some changes lately in the Drupal 4.7 source strings.
http://cvs.drupal.org/viewcvs/drupal/contributions/translations/drupal-pot/e...
Goba
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
Morten Wulff wrote:
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.
I have committed a different and simpler solution. Now you can define a write_header_custom() function if you would like to overwrite the default POT header with automatic language specific data.
Goba
Gabor Hojtsy wrote:
I have committed a different and simpler solution. Now you can define a write_header_custom() function if you would like to overwrite the default POT header with automatic language specific data.
Works like a charm.
Med venlig hilsen / Kind regards,
Morten Wulff