Internationalization and localization tools


Locale-Sensitive Function

char *nl_langinfo(nl_item item);

Internationalization (I18n) Function Overview

The nl_langinfo function can be used to access individual elements of the locale categories. Unlike the localeconv function, which returns all the information, nl_langinfo lets the caller select what information it requires. This is very fast and it is not a problem to call this function multiple times. A second advantage is that in addition to the numeric and monetary formatting information, information from the LC_TIME and LC_MESSAGES categories is available.

The type nl_type is defined in nl_types.h. The argument item is a numeric value defined in the header langinfo.h.

An example of where one would use the nl_langinfo function is the strftime format call like in the following example:

strftime (s, len, nl_langinfo (D_T_FMT), tp);

I18n Issues

Prior to calling nl_langinfo, ensure that the current locale is set properly by calling setlocale.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

Locale-Sensitive Functions

 

Lingoport internationalization and localization services and software