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.

Archive /

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

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

Problem with i18n translation for included .ss files


Go to End
Reply


12 Posts   16636 Views

Avatar
cliersch

Community Member, 75 Posts

29 April 2008 at 9:49pm

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

Avatar
Blynx

Community Member, 20 Posts

30 April 2008 at 5:57am

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

Avatar
dewoob

Community Member, 10 Posts

30 August 2008 at 11:11pm

Edited: 30/08/2008 11:30pm

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?

Avatar
ArX@nGeL

Community Member, 1 Post

9 September 2008 at 12:01pm

Edited: 09/09/2008 12:18pm

попробуйте так: ))
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;
   }

Go to Top