Internationalization and localization tools


Locale-Sensitive .NET JavaScript Method

date.localeFormat(format);
number.localeFormat(format);
String.localeFormat(format, argsArray);

Internationalization (I18n) Method Overview

The Date and Number localeFormat methods return a string based on the format parameter that is applied to the date or number. String.localeFormat is a static method that returns a string based on the format parameter which may contain fixed text as well as format items that are replaced by dynamic variables passed in the argsArray. For all of these methods, the current Culture (Locale) is used to determine any locale-sensitive formatting.

Note that these are Microsoft JavaScript Extended methods that require the .NET Framework. For additional method details, click here (Date), here (Number). and here (String).

I18n Issues

Whether or not calling localeFormat is an i18n issue is dependent on how it is being used in the application. There are two issues to be aware of:

  • The resulting formatted string needs to be locale-independent; i.e. it should always be the same, regardless the culture (locale).
  • The culture has not been properly set and so the formatted string will not be based on the correct culture.

Suggested Replacement

To ensure that the invariant culture is used rather than the current culture, call format. Otherwise, make sure that the current culture has been properly set in your .NET application before calling localeFormat.


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