internationalization - Turkish case conversion in JavaScript -
I would like to convert the string in local to Javascript in lower or upper case. I think the standard code like toUpperCase ()
and toLocaleUpperCase ()
do not meet this requirement toLocale
functions do not behave as much as they want.
For example, in Safari 4, Chrome 4 Beta, Firefox 3.5.x on my system incorrectly converts the wire with this Turkish characters. Answer Browsers Navigator.Language as "en-US"
, "tr"
, "en-US"
respectively. But there is no way to get the user's approved-lang
settings in the browser, as far as I could. Only Chrome gives me the "tr"
, although I have preferred every browser Turkish locale. I think these settings only affect the HTTP header, but we do not access these settings via javascript Can.
It says
Characters change within a string ... For the majority of languages while respecting the current locale, it will return the same way ... < / P>
I think it is valid for Turkey, it is no different, it is configured as N or TR in Turkey by "DİNÇ"
"dink"
and "DINÇ"
to "dınç"
or sub-race.
Is there a JavaScript library that meets this requirement? I think it should not just change the user locale properly, rather it should support the conversion through the local level parameters. Because developers can not access the user's configured preferred language.
coming back to provide more and more updated solutions later this year.
There is no need for hacks,
just use and
"dinç" .toLocaleUpperCase ('tr-TR') // "DİNÇ"
All browsers now support it.
[Old, do not use it]
Try these functions
string.prototype TeacherType = function () {var string = this; "I", "ç": "Ç", "I": "İ", "ş": "Ş", "ğ": "Ğ", "ü": "ü", "ö" ":" I "}; String = string Location (/ (([iışğüçö])) + / g, function (letter) {return letter [letter];}) return string Upupcase (); } String.prototype.turkishToLower = function () {var string = this; Var ":" I "," I ":" I "," Ş ":" ş "," Ğ ":" ğ "," ü ":" ü "," o ":" o "," c ":" Ç "}; String = string Location (/ (([[İiŞĞÜÇÖ])) + / g, function (letter) {return letters [letter];}) return string ToLowerCase (); } // Example "DİNÇ". TaturkishToLower (); // = & gt; DINK "DINÇ" TurkishToLower (); // = & gt; Dınç
I hope they will work for you.
Comments
Post a Comment