10375 Posts in 2190 Topics by 1707 members
|Go to End|
14 April 2009 at 5:06am
I just had some spare time and wrote a Script that extracts all translatable entries from a given Directory.
The Script is called LangBuilder and is attached to this post. It should work under Mac OS X or Linux with PHP installed. I wasn't able to test this on Windows as of now.
Extract the archive. The LangBuilder.php script is a command line PHP script. You'll need to set the executable permission bit (eg. chmod 0755 LangBuilder.php).
Open your shell and type:
LangBuilder.php module/dir pathto/outputfile.php
This will search the module/dir and all its sub-directories for translatable strings and write them to pathto/outputfile.php.
For help, just enter
I ran this script for the event_calendar module folder. Attached to this post, you'll find the auto-generated file (autocreated.php)
Hope that helps.
This script might be useful for all module developers. I should possibly provide it somewhere for download.
14 April 2009 at 5:15am
Wow, banal, I'm speechless. That is a really slick script for the two hours it took you. I had already started the copying-and-pasting process, but I suppose I can stop now and use your file. Anxious to use in my other modules. Please submit to the Silverstripe team. This is way to useful to be ignored.
Thanks a million!
14 April 2009 at 5:17am
One quick note.. did it manage to handle all of the date templating features okay? All I see is:
14 April 2009 at 5:22am
I've checked in the new lang file. Banal, any time you want to submit the German translation, I'd really appreciate that, as well.
I'm going to check in with my colleagues about getting you write access to the SVN. You've got a lot to offer and I think we need to facilitate your contributions to the code.
14 April 2009 at 8:32am
Glad the script is useful to you. Oh yes I see, now that you mention it... the date templates are broken. I guess my script can't resolve PHP variables as translate keys... that would be a task of other magnitude.
Hmm I think that's a case where the developer has to do some work on his own
Regarding SVN access: That would be nice, yes. You can contact me via mailbox [at] banal.ch
14 April 2009 at 6:52pm Last edited: 14 April 2009 7:22pm
I fixed a problem with the LangBuilder (escaped quotes were matched as closing quotes). You can find the new version here:
Oh, btw. There seems to be a utility like this built into SilverStripe:
It didn't work for me though.
Update: I was just informed, that as of SilverStripe 2.3, the textcollector can be invoked using the following url:
Use with caution, since this will overwrite your en_US.php file
|Go to Top|