Internationalization and localization tools


Locale-Sensitive JavaScript Method

string.toLocaleUpperCase();

Internationalization (I18n) Method Overview

This method returns a copy of the string converted to uppercase letters; the uppercase rules are based on the default locale. It works similarly to toUpperCase except that it should handle the few places where the locale is needed to return the correct character. For example, Turkish has both a dotted and a dotless lowercase i; calling toLocaleUpperCase with the default locale set to Turkish will correctly result in a dotted and dotless uppercase I.

Click here (w3schools) and here (MDN) for additional method details.

I18n Issues

toLocaleUpperCase uses the default locale, rather than the locale of the application, to determine how to uppercase letters. This may be problematic if the string has non-English characters and you want your internationalized application to run in a different locale.

Suggested Replacement

If the string will have non-English characters, and you want the application to be able to run in a locale that is other than the browser's locale, you will need to either handle casing in server-side code, or use a 3rd party JavaScript library which can support casing based on a locale parameter.


Globalyzer will detect this method and report it as an I18n issue. If you have determined that the call is being handled correctly, you can use Globalyzer's Ignore Comment functionality to ensure that it isn't picked up in a subsequent scan.



Locale-Sensitive JavaScript Methods

 

Lingoport internationalization and localization services and software