Jump to:

3429 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Problems with Translatable & 2.3.1

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

Page: 1
Go to End
Author Topic: 1895 Views
  • lazerscience
    Avatar
    Community Member
    16 Posts

    Problems with Translatable & 2.3.1 Link to this post

    Hi,
    I'm working on my first multilingual site with SS and I'm having troubles with the translatable class!
    I was trying to do everything according to http://doc.silverstripe.com/doku.php?id=multilingualcontent but could not get anything working at all!

    First I tried putting

    Translatable::set_default_locale(<locale>);

    in my _config.php, but this function doesnt seem to exist in my Ss version in the Translatable class!

    Furthermore if i try

    Object::add_extension('Page', 'Translatable');

    in _config.php or

       static $extensions = array(
    "Translatable"
    );

    in Page.php the result is always resulting in

    [Warning] Missing argument 1 for Translatable::__construct()

    I think I have to pass somehow the translatable fields to the decorator, but don't know how to do that!

    All in all i would just need a quick version to make all content translatable, and the site will feature at least 4 languages, so work arounds like creating seperate fields for languages doesnt really work, and translateable as shown in the tutorial would be perfect for me, but no idea how to get that working, any fast help is really appreciated! thanks!

  • masonz
    Avatar
    Community Member
    1 Post

    Re: Problems with Translatable & 2.3.1 Link to this post

    I've funnily enough been working through the exact same problem today; I've managed to enable the module using:

    Translatable::enable();

    And then doing a dev/build, however this still doesn't work correctly. I get an error message when trying to create a new translation:

    Error: Couldn't run query: SELECT `SiteTree`.*, `SiteTree_lang`.*, `SiteTree_lang`.*, `GhostPage`.*, `ErrorPage`.*, `RedirectorPage`.*, `VirtualPage`.*, `UserDefinedForm`.*, `SiteTree_lang`.OriginalLangID, if(`SiteTree_lang`.ClassName,`SiteTree_lang`.ClassName,'SiteTree') AS RecordClassName, `SiteTree_lang`.OriginalLangID AS ID, `SiteTree_lang_lang`.OriginalLangID AS ID FROM INNER JOIN `SiteTree_lang` ON `SiteTree_lang`.OriginalLangID = `SiteTree_lang`.OriginalLangID INNER JOIN `SiteTree` ON `SiteTree_lang`.OriginalLangID = `SiteTree`.ID LEFT JOIN `GhostPage` ON `GhostPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `ErrorPage` ON `ErrorPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `RedirectorPage` ON `RedirectorPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `VirtualPage` ON `VirtualPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `UserDefinedForm` ON `UserDefinedForm`.ID = `SiteTree_lang`.OriginalLangID WHERE (`SiteTree`.`ParentID` = 0 AND `SiteTree_lang`.OriginalLangID != 0) AND (`SiteTree_lang`.Lang = 'de') AND (`SiteTree_lang`.Lang = 'de') ORDER BY Sort You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN `SiteTree_lang` ON `SiteTree_lang`.OriginalLangID = `SiteTree_lang`.O' at line 1

    Anyway, any further ideas anyone? From as far as I can see the fix is to use the SVN trunk; is it safe to use yet?

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: Problems with Translatable & 2.3.1 Link to this post

    You guys might have noticed that translatable does not work currently, with 2.3.1 and I think also 2.3.0, it's mentioned quite often here.

    However that should not stop you from making multilanguage sites even with 2.3.1, see recipes:multilingual_content and Multilingual Content - alternative to 'translatable'.

  • lazerscience
    Avatar
    Community Member
    16 Posts

    Re: Problems with Translatable & 2.3.1 Link to this post

    As I mentioned above it's not a nice aternative for me to make seperate fields for seperate languages since the site will feature 4+ languages and probably grow! But you think there's no chance of getting Translatable work with 2.3.1?

    Is there anybody out there who managed to get Translatable working with 2.3.1 and can post his code?

  • keeny
    Avatar
    Community Member
    48 Posts

    Re: Problems with Translatable & 2.3.1 Link to this post

    It definately doesn't work with 2.3.1. I'm currently trying out 2.3.2beta1 which you can check out via svn. So far no luck tho... when I change the locale using

    http://<mysite>/mypage/?locale=de_DE

    I just get an error: The requested page couldn't be found.

  • keeny
    Avatar
    Community Member
    48 Posts

    Re: Problems with Translatable & 2.3.1 Link to this post

    Okay, so now I see each page has a unique url. So If I have an english version of home at http://mysite.com/home/ to get to the japanese version, I have to visit http://mysite.com/home-ja-JP/?locale=ja_JP

    BUT the locale is not persisted.

    If I then try to visit the about page by clicking a link in the navigation it goes to http://mysite.com/about-ja-JP/ and I get the error 'The requested page couldn't be found.'

    I have to explicitly visit http://mysite.com/about-ja-JP/?locale=ja_JP.

    Does anyone know how to make the locale persistant, so that once the user visits a Japanese page, the site STAYS in Japanese until they choose to switch back to English?

    Cheers,

    Barry.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts
    1895 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.