Internationalization and localization tools


Locale-Sensitive JavaScript Method

string.toUpperCase();

Internationalization (I18n) Method Overview

This method returns a copy of the string converted to uppercase letters; the uppercase rules follow the Unicode Character Database specifications.

Note: There are a few cases where the locale-independent Unicode results are incorrect. For example, Turkish has both a dotted and a dotless lowercase i, yet in both cases toUpperCase will result in the dotless uppercase I.

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

I18n Issues

toUpperCase uses the locale of the browser, rather than the locale of the application, to determine how to lowercase letters. This can be problematic if this 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, call toLocaleUpperCase which will work correctly if your application is to run in the default locale. If you want the application to be able to run in a locale that is other than the default 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