Jump to:

3401 Posts in 979 Topics by 855 members

Template Questions

SilverStripe Forums » Template Questions » Show page in the <available language> doesn't work

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

Page: 1
Go to End
Author Topic: 2948 Views
  • kudesign
    Avatar
    Community Member
    64 Posts

    Show page in the <available language> doesn't work Link to this post

    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!!

  • ChuckGyver
    Avatar
    Community Member
    5 Posts

    Re: Show page in the <available language> doesn't work Link to this post

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

  • carnal
    Avatar
    Community Member
    19 Posts

    Re: Show page in the <available language> doesn't work Link to this post

    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

  • schellmax
    Avatar
    Community Member
    126 Posts

    Re: Show page in the <available language> doesn't work Link to this post

    @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.

  • lovrenco
    Avatar
    Community Member
    3 Posts

    Re: Show page in the <available language> doesn't work Link to this post

    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?

  • lovrenco
    Avatar
    Community Member
    3 Posts

    Re: Show page in the <available language> doesn't work Link to this post

    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

    2948 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.