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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Problem with Event Calender


Go to End


30 Posts   7420 Views

Avatar
bummzack

Community Member, 904 Posts

14 April 2009 at 5:06am

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

Forum Moderator, 4102 Posts

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!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

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:

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

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.

Avatar
bummzack

Community Member, 904 Posts

14 April 2009 at 8:32am

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
bummzack

Community Member, 904 Posts

14 April 2009 at 6:52pm

Edited: 14/04/2009 7:22pm

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

Go to Top