Jump to:

23475 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Textcollector for module themes doesn´t work

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

Page: 1
Go to End
Author Topic: 2451 Views
  • AlexBeka
    Avatar
    Community Member
    21 Posts

    Textcollector for module themes doesn´t work Link to this post

    Hi,

    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 page.ss 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 ticket 4113, 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,
    Regards,
    Alex

  • StartUp3D
    Avatar
    Community Member
    10 Posts

    Re: Textcollector for module themes doesn´t work Link to this post

    Hi,
    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,
    Otto

  • mol
    Avatar
    Community Member
    5 Posts

    Re: Textcollector for module themes doesn´t work Link to this post

    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:

    $this->writeMasterStringFile($entitiesByModule);


    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).

  • mol
    Avatar
    Community Member
    5 Posts

    Re: Textcollector for module themes doesn´t work Link to this post

    BTW the much easier solution is to use LangBuilder.

    2451 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.