Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » I have to translate a field

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

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

Page: 1
Go to End
Author Topic: 1072 Views
  • antonio
    Avatar
    Community Member
    4 Posts

    I have to translate a field Link to this post

    Hi,
    i create a new field, when i start a translation I have the main content area and the BannerText area wich I have created. But when i go saving only the content area wil be translated, instead the BannerText area will be remain the same for each language. I try more then one way to take BannerText area translable but without success. I want to take translable the text nearby the foto on www.angelacelentano.com wich is the BannerText area. Thanks for any help.

    class HomePage extends Page {
    static $db = array(
    'BannerText' => 'HTMLText',
    );
    static $has_one = array();

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('BannerText', 'Testo Intro'));
    return $fields;
    }
    }

    class HomePage_Controller extends Page_Controller {
    }

  • antonio
    Avatar
    Community Member
    4 Posts

    Re: I have to translate a field Link to this post

    I try to insert this:
    static $extensions = array(
    "Translatable('BannerText')"
    );

    but it doesn't work .....

    class HomePage extends Page {
    static $db = array(
    'BannerText' => 'HTMLText',
    );
    static $has_one = array();
    static $extensions = array(
    "Translatable('BannerText')"
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('BannerText', 'Testo Intro'));
    return $fields;
    }
    }

    class HomePage_Controller extends Page_Controller {
    }

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