21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1286 Views |
-
language switch does not work

1 May 2010 at 1:20am Last edited: 1 May 2010 1:22am
hello all,
i´ve read i can simply switch languages by appending ?lang=de at the end of the url.
but this does not work.
I included this test link in my template:
<a href="$URLSegment?lang=en">English version</a>
which should do the job. but no luck.I have following language related code in my config:
i18n::set_locale('de_DE');
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(array('de_DE', 'en_GB'));
Object::add_extension('SiteTree', 'Translatable');Translating sites in general works fine. And I can see the translated sites by calling their specific urls.
Many thx,
Florian//SS.2.3.3//
-
Re: language switch does not work

4 May 2010 at 10:57pm Last edited: 4 May 2010 10:58pm
hello, i have read here:
http://doc.silverstripe.org/upgrading:2.3.2
switch with /lang=en is not longer supported.
I guess the same is true the same for /locale=en_GBThere are SEO reasons for that. So every page (also multilingual ones) has its own url.
I can switch language for homepage by this template link:
<a href="$get_homepage_urlsegment_by_locale(de_DE)">german</a>
but has somebody found a similar way for all pages?This is a nice way to switch languages. But it is only a switch.
<% control Translations %><% if Locale == "en_GB" %>
<a href="$Link">English version </a>
<% end_if %><% if Locale == "de_DE" %>
<a href="$Link">Deutsche Version</a>
<% end_if %><% end_control %>
But instead of a switch i need a list of all available languages...
I continue investigating
florian
-
Re: language switch does not work

5 May 2010 at 3:14am
hello! i now use this:
<% if Translations %>
<ul class="translations">
<% control Translations %>
<li>
<a href="$Link" hreflang="$Locale.RFC1766" title="$Title">$Locale</a>
</li>
<% end_control %>
</ul>
<% end_if %>I´ve found this here: http://doc.silverstripe.org/multilingualcontent
This code shows all translations available for the current page. Just not the current one.
A click on a language link shows the translated page in the selected language.florian
| 1286 Views | ||
|
Page:
1
|
Go to Top |

