Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Problem with Event Calender


Reply

30 Posts   4022 Views

Avatar
banal

14 April 2009 at 5:06am Community Member, 901 Posts

Hi UncleCheese

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.

Usage instructions:
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

LangBuilder.php

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.

Attached Files
Avatar
UncleCheese

14 April 2009 at 5:15am 4085 Posts

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!

Avatar
UncleCheese

14 April 2009 at 5:17am 4085 Posts

One quick note.. did it manage to handle all of the date templating features okay? All I see is:

$lang['en_US']['Calendar']['$key'] =
   '';

Avatar
UncleCheese

14 April 2009 at 5:22am 4085 Posts

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.

Avatar
banal

14 April 2009 at 8:32am Community Member, 901 Posts

Hi UncleCheese

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

Avatar
banal

14 April 2009 at 6:52pm (Last edited: 14 April 2009 7:22pm), Community Member, 901 Posts

Hello

I fixed a problem with the LangBuilder (escaped quotes were matched as closing quotes). You can find the new version here:
http://bummzack.ch/langbuilder

Oh, btw. There seems to be a utility like this built into SilverStripe:
http://doc.silverstripe.com/doku.php?id=i18n&s=textcollector#collecting_text

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:
dev/tasks/i18nTextCollectorTask?module=modulename
Use with caution, since this will overwrite your en_US.php file