Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Show page in the <available language> doesn't work


Reply


6 Posts   3116 Views

Avatar
kudesign

Community Member, 64 Posts

3 August 2009 at 11:20am

v2.3.2. I have read all the docs in relating to the multi language contents, when I was trying to insert the code for the available language chooser using control in the template, the code suggested in the docs (http://doc.silverstripe.com/doku.php?id=multilingualcontent&s=language%20chooser) does not seem to work.

<% if Translations %>
<ul class="translations">
<% control Translations %>
<li class="$Locale.RFC1766">
<a href="$Link" hreflang="$Locale.RFC1766"
title="$Title">
<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice)%>
</a>
</li>
<% end_control %>
</ul>
<% end_if %>

Firstly, typo as there should be an extra space between .Nice) & %> stated in this code:

<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice)%>

Secondly, the '$Locale.Nice' doesn't work, as it does not translate to the name of the available language.

When a interested user spend much time to follow the steps to try to get something to work, only to find out that the steps were written incorrectly...

I think SS can improve in this area, as it is such a promising CMS, only to find out half of the modules don't work, even the simple Mollom anti-spam is difficult to implement, with too many versions & compatibility issues.

After 3 days of trying, and asking questions in the forums with no reply, I felt SS can improve in this area.

Has anyone got the available language chooser to work on their templates? anyone? SS team? Please help!!

Avatar
ChuckGyver

Community Member, 5 Posts

6 August 2009 at 7:38pm

Edited: 06/08/2009 7:38pm

[url]http://silverstripe.org/general-questions/show/263314#post263314[/url] , so ive made translations in templates. may this can help u

Avatar
carnal

Community Member, 19 Posts

15 September 2009 at 6:26am

Edited: 15/09/2009 6:26am

There is an error in the doku at:
http://doc.silverstripe.com/doku.php?id=multilingualcontent&s=language%20chooser

In Section "Add new locales" it says:

i18n::$common_locales['de_AT'] = 'Deutsch (Oestereich)';

that is wrong it has to be:

i18n::$common_locales['de_AT'] = array('Deutsch', 'Deutsch (Oestereich)');

I don't know wich language you like to add, but here could be the error.

Regards

Carnal

Avatar
schellmax

Community Member, 126 Posts

12 January 2010 at 7:08am

@carnal: thanks a lot, your post on the error in the docs just helped me out. i'll post a comment on the corresponding docs page.

Avatar
lovrenco

Community Member, 3 Posts

20 July 2010 at 9:04am

Hi,

i enter this

<% if Translations %>
<ul class="translations">
<% control Translations %>
<li class="$Locale.RFC1766">
<a href="$Link" hreflang="$Locale.RFC1766"
title="$Title"><% sprintf(_t('SHOWINPAGE','%s'),$Locale.Nice) %></a></li>

<% end_control %>
</ul>
<% end_if %>

And it works well. But someone tell me how can I display current locale on that list?

Avatar
lovrenco

Community Member, 3 Posts

20 July 2010 at 9:27am

OK, I messed around a little and here it goes:

<% if Translations %>
<ul class="translations">
<% control Translations %>
<li class="$Locale.RFC1766">
<a href="$Link" hreflang="$Locale.RFC1766"
title="$Title"><% sprintf(_t('SHOWINPAGE','%s'),$Locale.Nice) %></a>
<% end_control %>
<a href="$Link" hreflang="$Locale.RFC1766" title="$Title">$Locale.Nice</a>
</li>

</ul>
<% end_if %>

Now it prints current language too, but always on last place... and for language selector it would be nice to keep consistency (all langs on same place on page). Any idea how to achieve that.... I will also surf a little more