Internationalization and localization tools


Locale-Sensitive Perl Method

$time = strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1);

Internationalization (I18n) Method Overview

The strftime function converts date and time information to a string, which it then returns. The fmt option can take numerous format specifiers. Most specifiers are not locale sensitive. The aAbBcpZ specifiers are locale sensitive and may be used for user-displayed dates in internationalized applications.

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

I18n Issues

Since most format specifiers that strftime takes are not locale sensitive, care must be taken with this function. Avoid using non locale sensitive format specifiers when generating date/time strings to be displayed to users.

Suggested Replacement

Use the specifiers aAbBcpZ, which are locale sensitive, for user-displayed results. Be aware that this locale sensitivity means that strftime results using these specifiers are not portable. For results processed only by internal program logic, use numeric specifiers instead.

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