Internationalization and localization tools


Locale-Sensitive Perl Method

$time = ctime();

Internationalization (I18n) Method Overview

The POSIX::ctime function is equivalent to asctime(localtime(...)). It returns time and date information in the format: "Fri Jun 2 18:22:13 2000\n\0".

See perl's POSIX function documentation and perllocale for additional details.

I18n Issues

The date format "Fri Jun 2 18:22:13 2000\n\0", as returned by ctime, is locale specific to English locales.

Suggested Replacement

Use POSIX::strftime with parameters generated from localtime instead. strftime takes format specifiers describing the date/time format to output. The specifiers aAbBcpZ are all locale sensitive. Be aware that this locale sensitivity means that strftime results are not portable. Use the locale sensitive specifiers for user-displayed results, but numeric specifiers for internal program logic.

Globalyzer will detect this function 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 Perl Methods

 

Lingoport internationalization and localization services and software