Internationalization and localization tools


Locale-Sensitive JavaScript IBM I18n Method

toString(date:Date) : string
toString(date:Date, loc:Locale) : string

toString(date:Date, pattern:string) : string
toString(date:Date, pattern:string, loc:Locale) : string

toString(number:double) : string
toString(number:double, loc:Locale) : string

toString(number:double, pattern:string) : string
toString(number:double, pattern:string, loc:Locale) : string

toString(number:double, pattern:string, valueIfZero:string) : string
toString(number:double, pattern:string, valueIfZero:string, loc:Locale) : string

Internationalization (I18n) Method Overview

The toString method produces a string value that represents the value of the date or number formatted according to the given pattern and according to the conventions of the given locale. If the pattern is missing or null, the number is formatted according to a default format. If the Locale parameter is missing or null, the number is formatted according to the XSP server default locale. Click here for additional details.

I18n Issues

Because the default locale may not be the correct locale for all users, it is good i18n practice to use the method signature that accepts a Locale argument and to further pass in a Locale object that has been dynamically generated based upon the user's preferences.

Globalyzer will detect this method and report it as an i18n issue regardless of the signature used and regardless of whether it is being used correctly. If Locale is already being passed as an argument, Globalyzer will detect it to force developers to double check that the correct Locale is being passed. 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