Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » how to correctly install translatable

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1598 Views
  • kochab2
    Avatar
    Community Member
    5 Posts

    how to correctly install translatable Link to this post

    hi,
    I am following the instructions for installing the translatable module from github, using the latest master from the repository:

    https://github.com/silverstripe/silverstripe-translatable/blob/master/docs/en/index.md

    I do not understand this section:

    Through $extensions

    :::php
    class Page extends SiteTree {
    static $extensions = array(
    "Translatable"
    );
    }

    where is this supposed to go?

    If I do not add it, I can install translatable but clicking on the "Create" translation page does nothing.

    any hint appreciated,
    thanks,

    kochab

  • martimiz
    Avatar
    Forum Moderator
    1078 Posts

    Re: how to correctly install translatable Link to this post

    Hi Kochnab2,
    First of all: ignore the :::php bit: this is a directive for the sintaxhighliter in the docsviewer application, that doesn't work on GitHub.

    The translatable module is basically an extension (decorator) that you have to enable for it to work. As the helpfile says: there are more ways to do this, but it's 'either or', not 'and'. So adding this to your mysite/_config.php file should do the trick:

    Object::add_extension('SiteTree', 'Translatable');
    Object::add_extension('SiteConfig', 'Translatable');

    Mind to do a /dev/build?flush=1 afterwards. The fact that you can create a translation Seems to indicate that the module is installed, so something else is going wrong. You say create translation does nothing. Do you get any errormessage? What version of SilverStripe are you using?

  • kochab2
    Avatar
    Community Member
    5 Posts

    Re: how to correctly install translatable Link to this post

    Thank you very much,
    I am using silverstripe 3.0.2, I tried upgrading to 3.0.3 but I get some issues in the backend, so prefer to stick with 3.0.2.
    I made the changes to the _config file,

    First I got this error:

    PHP Fatal error: Call to undefined method MySQLDatabase::isSchemaUpdating() in /data/www/cosmo3/silverstripe-translatable/code/model/Translatable.php on line 1201


    so I commented that line out and the extension seem to be installed.

    But in the backend, in the "Translations" tab,
    when I click on the "Create" button to create a translation, nothing happens and I get no errors, I activated also the error log, but that shows nothing as well.

    Any help appreciated. Thanks.

  • kochab2
    Avatar
    Community Member
    5 Posts

    Re: how to correctly install translatable Link to this post

    Ok,
    I think I found the problem,
    it looks like the "Create" button has the "name" attribute: action_createtranslation

    which is defined in:

    CMSMain.Translatable.js

    but this javascript file is not included in the backend page,
    do you know how to fix this?

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: how to correctly install translatable Link to this post

    im having the same problem on 3.02 with the latest translatable module... uploaded it under the name: translatable...
    ran a dev/build?flush=1..

    got error during dev/build..

    Fatal error: Call to undefined method MySQLDatabase::isSchemaUpdating() in /url/translatable/code/model/Translatable.php on line 1201

    now upgrading to 3.03 and see what happens..

  • kochab2
    Avatar
    Community Member
    5 Posts

    Re: how to correctly install translatable Link to this post

    yeah, if you comment that line out it looks like the install works, but then the javascript scripts are not included correctly in the backend.
    Is anybody maintaining this module?

  • Molodoi
    Avatar
    Community Member
    6 Posts

    Re: how to correctly install translatable Link to this post

    Hello,

    Decompress your module and rename silverstripe-translatable-master to translatable.

    Follow install process inspired of http://www.balbuss.com/

    In your mysite/code/Page.php

    <?php
    class Page extends SiteTree {
    static $extensions = array(
    "Translatable"
    );
    some code ...

    And add this line in your _config.php

    LeftAndMain::require_javascript('silverstripe-translatable/javascript/CMSMain.Translatable.js');
    //My exemple is for website translate in 3 languages
    Translatable::set_default_locale('fr_FR');
    Object::add_extension('SiteTree', 'Translatable');
    Object::add_extension('SiteConfig', 'Translatable'); // 2.4 or newer only
    Translatable::set_allowed_locales(array(
    'en_GB', //UK English
    'nl_NL', //Ducth
    'fr_FR' //French
    )
    );

    Have a lot of fun ;)

    The translation module is definitely not working or just simply page!

    My error in the jquery notice in backend is :
    Error Line 580 ../framework/model/MySQLDatabase.php

    An Sql Error?... Just for

    I can do some dev / build... nothing works...

    I created a new PageType ContactPage with the code follow :

    <?php
    class ContactPage extends Page {

    static $db = array(
    'Mailto'=>'Varchar(100)',
    'SubmitText'=>'Text',
    'Nom'=>'Varchar(50)',
    'Adresse'=>'Varchar(50)',
    'Ville'=>'Varchar(50)',
    'CP'=>'Varchar(50)',
    'Region'=>'Varchar(50)',
    'Pays'=>'Varchar(50)',
    'Phone'=>'Varchar(50)',
    'GPS'=>'Varchar(50)'
    );

    public function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.SoumissionForm", $myMailTo =new TextField('Mailto', 'Email du destinataire '));
    $fields->addFieldToTab("Root.SoumissionForm", $mySubmitText = new TextareaField('SubmitText', 'Texte du mail'));

    $fields->addFieldToTab("Root.Coordonnees", $myNom = new TextField('Nom', 'Raison Sociale'));
    $fields->addFieldToTab("Root.Coordonnees", $myAdresse = new TextField('Adresse', 'Adresse'));
    $fields->addFieldToTab("Root.Coordonnees", $myVille = new TextField('Ville', 'Ville'));
    $fields->addFieldToTab("Root.Coordonnees", $myCP = new TextField('CP', 'Code Postale'));
    $fields->addFieldToTab("Root.Coordonnees", $myRegion = new TextField('Region', 'Région'));
    $fields->addFieldToTab("Root.Coordonnees", $myPays = new TextField('Pays', 'Pays'));
    $fields->addFieldToTab("Root.Coordonnees", $myPhone = new TextField('Phone', 'Téléphone'));
    $fields->addFieldToTab("Root.Coordonnees", $myGPS = new TextField('GPS', 'Coordonnées GPS : Latitude,Longitude'));

    $translation = $this->getTranslation(Translatable::default_locale());

    if($translation && $this->Locale != Translatable::default_locale()) {

    $transformation = new Translatable_Transformation($translation);

    $fields->replaceField('Mailto',$transformation->transformFormField($myMailTo));
    $fields->replaceField('SubmitText',$transformation->transformFormField($mySubmitText));
    $fields->replaceField('Nom',$transformation->transformFormField($myMailTo));
    $fields->replaceField('Adresse',$transformation->transformFormField($myMailTo));
    $fields->replaceField('Ville',$transformation->transformFormField($myMailTo));
    $fields->replaceField('CP',$transformation->transformFormField($myMailTo));
    $fields->replaceField('Region',$transformation->transformFormField($myMailTo));
    $fields->replaceField('Pays',$transformation->transformFormField($myMailTo));
    $fields->replaceField('Phone',$transformation->transformFormField($myMailTo));
    $fields->replaceField('GPS',$transformation->transformFormField($myMailTo));
    }

    return $fields;
    }

    }
    class ContactPage_Controller extends Page_Controller {

    public function init() {
    parent::init();

    }

    }

    If someone have an idea to create and traduce a new type of page.

    I'm really desperate... one month to work for nothing, my client project is on standby... what has become my favorite SS version 2.4.5...

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