Jump to:

23553 Posts in 19380 Topics by 2892 members

General Questions

SilverStripe Forums » General Questions » translations for dataObjects

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: 1090 Views
  • dacar
    Community Member
    168 Posts

    translations for dataObjects Link to this post


    for my site i want to show some articles on a article holder page. every article is saved as an dataobject to the db, not to the sitetree. the translation (i18n) for my sitetree elements works fine. But how can i use i18n for my dataobjects.

    At the moment i have done the following but i think, that is not the right way?!

    I have added a new object (transtable) to my _config.php: Object::add_extension('Dermatologie', 'Translatable');

    After "dev/build" i got the new table "dermatologie_translationgroups". But i did not know to pass the values to it. So i decided to fill the new field "Locale" in "Dermatologie" with the language values used on the site:

    function getCMSFields() {

          $array = array(
           'de_DE' => 'deutsch',
           'en_GB' => 'englisch',
           'ru_RU' => 'russisch',
           'fr_FR' => 'französisch',
           'es_ES' => 'spanisch',

          $fields = new FieldSet(
             new CheckboxField('anzeigen', 'Artikel ein-/ausblenden'),
             new CalendarDateField('gueltigab', 'Anzeigen ab dem'),
             new DropdownField(
                'sprache wählen',
             new TextareaField('Headline', 'Überschrift'),
             new TextareaField('Subheadline', 'Subheadline'),
             new HtmlEditorField('Copytext', 'Artikeltext'),
             new ImageField('Thumb', 'Artikelbild')

          return $fields;

    So i am able to give eache article a specific language.

    Here are my questions:

    1. How can i get the languages currently used in my Sitetree (translations) to pass them to my array. So it is more flexible in future.
    2. I think this is the wrong way to solve this problem. How do you translate your dataobjects?
    3. Does anybody know if there is a way tou use "/dev/tasks/i18nTextCollectorTask" without PHPUnit being installed on the Server (shared Hosting, CGI)?

    I hope the will be a helpful discussion on item 2 ;-)

    Greetings, Carsten.

  • dacar
    Community Member
    168 Posts

    Re: translations for dataObjects Link to this post


    i have found this article http://silverstripe.org/dataobjectmanager-module-forum/show/265720?start=16 and tried this patch http://open.silverstripe.org/ticket/4435.

    The patch works fine. now you can pass the locale by URL. But the locale is not passed to my managed module. Is there a way to attach the locale to all links within the CMS? With this feature you could switch between the languages and have your language specific dataobjects.

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.