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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Textcollector for module themes doesn´t work


4 Posts   2463 Views


5 August 2009 at 10:58pm (Last edited: 5 August 2009 10:59pm), Community Member, 21 Posts


when i run the textcollector by "$link/dev/tasks/i18nTextCollectorTask?module=themes" then it just says "Running task 'i18n Textcollector Task'..." and nothing happens, no subdirectory "lang" is created under /themes;
i just added the following line to the template under /themes/themename/templates/, so the textcollector should find it;

   <% _t('GoToEnglishTranslation','Go to the english translation') %>

further when i run the textcollector for all modules with $link/dev/tasks/i18nTextCollectorTask then i get an error that it needs phpunit, which is also described in [url=]ticket 4113[/url], so this just works with installed phpunit for 2.3.3, but this would be no problem if i could run the textcollector just for the themes module;

help is very welcome,


6 August 2009 at 9:59pm Community Member, 10 Posts

same problem here. Just tried it like AlexBeka with the same result. Also i can´t install PHPUnit, because i´m on a shared hosting server.

Anyone who got that running already?

Best regards,


14 August 2009 at 9:05am Community Member, 5 Posts

Disclaimer: I'm using SilverStripe for cca 2 days, so sorry if anything I wrote is wrong
1) themes is not a module, but just an ordinary directory (it does not have _config.php for example), so ?module=themes is meaningless
2) translations of templates must go to mysite/lang, so it's absolutely OK, that it does not create themes/lang
3) if you are brave you can try my patch to textcollector:
a) please backup you whole site :-), especially the mysite/lang content as it will be overwritten
b) put

$entitiesArr = array();
         $fileList = $this->getFilesRecursive("$this->basePath/themes/gu");
         foreach($fileList as $index => $filePath) {
Debug::message($filePath, false);
            $content = file_get_contents($filePath);
            // templates use their filename as a namespace
            $namespace = basename($filePath);
            $entitiesArr = array_merge($entitiesArr, (array)$this->collectFromTemplate($content, $module, $namespace));
         $entitiesByModule['mysite'] = $entitiesArr;

to the sapphire/core/i18nTextCollector.php before the line:


c) replace gu on the second line of the patch with name of your theme
d) run dev/tasks/i18nTextCollectorTask/?module=x (note: the x is just any nonexistent module name, so it won't process any real modules, so it will run much faster)
e) it should display processed files
f) in the mysite/lang/en_US.php should appear new translations

I do not guarantee anything (see disclaimer above).


14 August 2009 at 9:36am Community Member, 5 Posts

BTW the much easier solution is to use [url=]LangBuilder[/url].