22850 Posts in 9711 Topics by 2803 members
|Go to End|
29 September 2009 at 11:24pm
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
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.
29 September 2009 at 11:50pm
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.
30 September 2009 at 6:03pm Last edited: 30 September 2009 6:04pm
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
2 October 2009 at 5:14am
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 %>
|Go to Top|