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, Ed, biapar, Willr, Ingo, swaiba

Translatable: Return only Language

Go to End

2 Posts   911 Views


Community Member, 37 Posts

1 December 2009 at 3:25am


I feel very silly because I feel I've achieved much more complicated things than that in my few days of learning Silverstripe, but I can't figure out how to return only the Language of the Locale.
For example, if the language is en_US, I want to display EN.

Does something already exists, like the .Nice format or the .RFC1766 format. (and where do I find a list of these existing formats)?

Or do I have to a php function in the Page_Controller?
(A bit of help with that too, if that's what I have to do, will be much appreciated too)




Community Member, 95 Posts

3 December 2009 at 6:18pm

Edited: 03/12/2009 6:23pm

I think there is an array in sapphire/core/i18n.php called $common_locales that you can use as a lookup table to translate your locale to the name of the language. if that doesnt work, there are a few other arrays in i18n that may help.

i think this might work (not tested)