Jump to:

23472 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Multilanguage Website with SS 2.3.3

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: 1680 Views
  • Andre
    Community Member
    126 Posts

    Multilanguage Website with SS 2.3.3 Link to this post

    Hi, I'm really trying for a long time and tried to get familiar with the i18n and multilinugualcontent documentations

    But I don't get it.

    What I want is a simple Page (to start with first, later there will be relations with dataobjects, but lets keep it simple first) with 2 or more Languages.

    So I added the following to my _config.php

    // add multilanguage Support
    Object::add_extension('SiteTree', 'Translatable');

    This Way I got german for the Frontend Language and the Pagecomments module translatet to german too. Fine, in the Backend I have a languagdropdown now, which shows my default Pagetree is german. When clicking the translation tab and saving the page to an new language, I get a second sitetree for this language. The Pages in the second Sitetree all have a different url so it is not working for to get the translatet site only by adding the locale variable to the url (/home-de?locale=en_GB does show the german content and only /home-en shows the translatet page).

    I found the following and added it to the init function of my Page_controller.


    but nothing is changing.

    So my question is at first, how to use the translation? When translating a site it seems, a new Page Object is created, but how is it related to it's sibling in other languages?

    Next Question, if I change to URL /home-de?locale=en_GB or /home-en, the Pagecomments are still translated to german. How do I have to Tell Silverstripe which language is chosen for the moment? (same for Modules that should be available for multilanguages)

    Last question, is there a simple way to have nice URLs for Translation like /de/home and /en/home?
    I know there is an existing tutorial about that but it's nearly thwo years old and based on Silverstripe 2.0 or 2.2.

  • Andre
    Community Member
    126 Posts

    Re: Multilanguage Website with SS 2.3.3 Link to this post

    Sorry, I was a bit Wrong.

    Adding the i18n-Lines to the init Function of the Pagecontroller is translating the Pagecomments to english on /home-en so I think it should work for Modules too.

  • profimus
    Community Member
    8 Posts

    Re: Multilanguage Website with SS 2.3.3 Link to this post

    So Andre,

    Is it working now?
    I've spent a lot of time by looking for Silverstripe multilanguage solution but nowhere is clearly written step by step on how to achieve this.
    Your post for me seems now one of the best, because not every user has deep skills in programming, and they shoose Silverstripe exactly for the simplicity in using back-end features (I think so). Then of course they want more and more features

  • Andre
    Community Member
    126 Posts

    Re: Multilanguage Website with SS 2.3.3 Link to this post

    It is working fine.

    I got help from the German Forum.

    When Translationg a Page it is still relatet to its sibbling in the default language.

    Just put the following into your Master Template and you can switch from german site to its english translation and back.

    <% if Translations %>

    <% control Translations %>

    <% if Locale == "en_GB" %>

    <a href="$Link" title="english"><img class="lang" src="themes/dummytheme/images/lang_english.gif" alt="English" /></a>

    <% else_if Locale == "de_AT" %>

    <a href="$Link" title="deutsch"><img class="lang" src="themes/dummytheme/images/lang_german.gif" alt="Deutsch" /></a>

    <% end_if %>

    <% end_control %>

    <% end_if %>

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.