Internationalization and localization tools


Locale-Sensitive .NET JavaScript Method

Date.parseLocale(string);
Date.parseLocale(string, formats);
Number.parseLocale(string);

Internationalization (I18n) Method Overview

The Date and Number parseLocale static methods parse a date for number string based on the current culture (locale); for example, the current culture will determine if a period or a comma should be treated as the decimal point in a number string, or if the first number in a date string is the month or the day. The Date's formats optional parameter allows you to override the Sys.CultureInfo.CurrentCulture properties.

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

I18n Issues

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

  • The date or number string is locale-independent; i.e. it should always be parsed 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 parseInvariant. Otherwise, make sure that the current culture has been properly set in your .NET application before calling parseLocale.


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