Setlocale returns false (WAMP)

I have working localization in my project. Working means that my project gets translated to whatever language I have in the locale/sk folder, sk for slovak being my default system language.

Setting to any other language doesn't work. I have tried $lang = 'cs', 'cz', 'en', 'en_UK', 'en_UK.utf8' and others. Still, only the translation in the 'sk' folder is taken and still the setlocale() function returns false. I have tried to change default language in browser - no effect.

This is my code:

putenv("LANG=$lang"); 
setlocale(LC_ALL, $lang); 
bindtextdomain("messages", realpath("../localem")); 
textdomain("messages");
...
_("Welcome!")

I have also tried these:

putenv("LANGUAGE=$lang"); 
putenv('LC_ALL=$lang');

Any suggestions are welcome.

Edit:

$loc = array('nor');
if (setlocale(LC_ALL, $loc)==false) print ' false'; else print setlocale(LC_ALL, $loc);

'nor' prints Norwegian (Bokmĺl)_Norway.1252, 'rus' russian, but 'svk' prints false and so does 'cze'.

On the list all of these are mentioned:

http://msdn.microsoft.com/en-us/library/cdax410z%28v=vs.80%29.aspx

Answers


Windows uses another format for the locale setting, see MSDN: List of Country/Region Strings.

You can send a list of locales to setlocale by sending in an array, such as to get Norwegian month names and time formats:

setlocale(LC_TIME, array('nb_NO.UTF-8', 'no_NO.UTF-8', 'nor'));

Windows might however return strings in another encoding than UTF-8, so you might want to handle this manually (converting from cpXXXX to UTF-8).


Need Your Help

Loaded image in UIImage is pixelated on retina

iphone image retina-display pixelate

I parsed the data from a web which also contains jpg image. The problem is that the image looks blurry/pixelated on retina display. Any solution for this? Thanks.

Consume elements from ConcurrentHashMap

java hashmap java.util.concurrent concurrenthashmap

I use a ConcurrentHashMap to buffer messages for a websocket.