Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » (Solved) translation in .php

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: 1070 Views
  • Webdoc
    Avatar
    Community Member
    332 Posts

    (Solved) translation in .php Link to this post

    How to translate the array-s in php and how to setup them in lang file

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: (Solved) translation in .php Link to this post

    Have a read of the documentation on http://doc.silverstripe.org/i18n. That should have all you need to know!

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: (Solved) translation in .php Link to this post

    "Enum('_t('Objekt.KORTER');, _t('Objekt.MAJA');, _t('Objekt.ARIPIND');, _t('Objekt.SUVILA');, _t('Objekt.RIDAELAMU');, _t('Objekt.PAARISMAJA');, _t('Objekt.MAATYKK');')"

    gives error:
    184             case T_STRING:
    185                switch($token[1]) {
    186                   case 'true': $args[] = true; break;
    187                   case 'false': $args[] = false; break;
    188                   default: throw new Exception("Bad T_STRING arg '{$token[1]}'");

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: (Solved) translation in .php Link to this post

    is it even possible to make translateable the enum and then the searchable field title

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: (Solved) translation in .php Link to this post

    You can't have translations in Enums (as that would make the enum pretty useless). You have to pick a single language from the enum. If you want to translate the labels you can use if ($x = "Foo") .. $label = _t('FOO', 'Foo'); to translate it. Note you also can't use variables inside a _t() as that too would make things not work.

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: (Solved) translation in .php Link to this post

    Tnx
    made it easier way used:
    $form->disableSecurityToken();
    for search so i was able to made search template myself with costum code no need for securityID

    and for enums added both languages in one enum they where only needed for filtered search.

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