How to set locale in JavaScript, for example for toLocaleUpperCase()?

Amir E. Aharoni picture Amir E. Aharoni · Jan 27, 2013 · Viewed 11.8k times · Source

I'd like to use the JavaScript toLocaleUpperCase() method to make sure that the capitalization works correctly for the Turkish language. I cannot be sure, however, that Turkish will be set as the user's locale.

Is there a way in modern browsers to set the locale in run time, if I know for sure that the string is in Turkish?

(I ran into this problem while thinking about Turkish, but actually it can be any other language.)

Answer

SimonDever picture SimonDever · Apr 12, 2013

There isn't really anything much out there but I came across this JavaScript setlocale function script that you might find useful.