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.

General Questions

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

Sorting Languages


Reply

2 Posts   1108 Views

Avatar
patjnr

12 October 2009 at 8:29pm (Last edited: 15 October 2009 8:19am), Community Member, 101 Posts

Hi

i have a multilingual website with 4 translations ie de, fr, it, en. and im populating a drop down with all the available languages..

<% if Translations %>
<FORM NAME="form2">
<SELECT NAME="select" >
<% control Translations %>
<OPTION <% if current %>selected<% end_if %> VALUE="$link"><% sprintf(_t('SHOWINPAGE',' %s'),$name) %></option>
<% end_control %>
</SELECT>
</FORM>
<% end_if %>

this is producing all languages in this order;

english
Deutsch
français
italiano

Now how do i sort these languages, i want english to come last of this list.

tx

Avatar
CodeGuerrilla

16 May 2011 at 6:52pm Community Member, 105 Posts

I would also like to know how to do this, I have looked at overloading Translatable::getTraslations but don't really see a way to do this as the language name is in the _config.php file and stored in: i18n::$common_locales, I also don't understand in which order they are currently appearing am guessing is the order the translations were created in the CMS? As it does not appear the order is by locale or by the order of $common_locales array.