Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Problem with i18n translation for included .ss files

Our old forums are still available as a read-only archive.

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

Page: 1 2
Go to End
Author Topic: 16362 Views
  • cliersch
    Avatar
    Community Member
    75 Posts

    Re: Problem with i18n translation for included .ss files Link to this post

    Ah - when you add these (in the cms/lang/en_US.php and the other languages):

    $lang['en_US']['PageCommentInterface.ss']['PBY'] = 'Posted by';
    $lang['en_US']['PageCommentInterface.ss']['APPROVE'] = 'approve this comment';
    $lang['en_US']['PageCommentInterface.ss']['ISSPAM'] = 'this comment is spam';
    $lang['en_US']['PageCommentInterface.ss']['ISNTSPAM'] = 'this comment is not spam';
    $lang['en_US']['PageCommentInterface.ss']['REMCOM'] = 'remove this comment';

    it will work! Thank you for helping me!!! Great! I tried it before in different ways with no result but that's it! I guess the i18n translation is al little bit shaky because you have to find the included files. And sometimes there are strange effects in the results.....
    Cheers,
    tiga

  • Blynx
    Avatar
    Community Member
    20 Posts

    Re: Problem with i18n translation for included .ss files Link to this post

    Glad I could help. And even better to hear that it works

  • dewoob
    Avatar
    Community Member
    10 Posts

    Re: Problem with i18n translation for included .ss files Link to this post

    Generally, I don't get the point why it makes sense to have such a "deep" tree structure in the LOCALE stuff:

    $lang['en_US']['PageCommentInterface_singlecomment.ss']['REMCOM'] = "...";

    Why not just $lang['en_US']['REMCOM'] = "..."; ?

    There should be at least something like
    $lang['en_US']['default']['REMCOM'] = "...";

    This way, one *could* still define different names for different classes *optionally*. At this moment it seems like we had to re-define the comment (and probably some more) translations for the different classes, which is a not-so-nice redundancy.

    By the way, does anybody know how to place edited translation files from /cms/lang/xx_XX.php into a project-specific directory, so that silverstripe can be upgraded without overwriting them?

  • ArX@nGeL
    Avatar
    Community Member
    1 Post

    Re: Problem with i18n translation for included .ss files Link to this post

    попробуйте так: ))
    edit SSViewer.php. replace this

       public static function getTemplateContent($identifier) {
          return file_get_contents(SSViewer::getTemplateFile($identifier));
       }

    on this

       public static function getTemplateContent($identifier) {
          $content = file_get_contents(SSViewer::getTemplateFile($identifier));
          $content = ereg_replace('<' . '% +_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\) +%' . '>', '<?= _t(\''. $identifier . '.ss.\\2\\3\'\\4) ?>', $content);
          $content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>) +%' . '>', '<?= sprintf(_t(\''. $identifier . '.ss.\\2\\3\'\\4),\\6) ?>', $content);
          return $content;
       }

    16362 Views
Page: 1 2
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.