note 39127 added to function.nl-langinfo

From: Date: Sun, 18 Jan 2004 06:18:40 +0000
Subject: note 39127 added to function.nl-langinfo
Groups: php.notes 
Request: Send a blank email to php-notes+get-63760@lists.php.net to get a copy of this message
The nl_langinfo() function returns a string containing information relevant to the particular language or cultural area defined in the program's locale. The manifest constant names and values of item are defined in <langinfo.h>. For example, nl_langinfo(ABDAY_1) would return a pointer to the string "Dom" if the identified language was Portuguese, and "Sun" if the identified language was English. The nl_langinfo() function is inspired by a C function, conforms to Version 2 of the Single UNIX Specification (``SUSv2''). The integer to pass, its constant name and the description depends of OS. So the numbers listed here are not relevant on other OS than FreeBSD (and never use them in your PHP softwares !). 0 - CODESET - codeset name 1 - D_T_FMT - string for formatting date and time 2 - D_FMT - time format string 3 - T_FMT - time format string 4 - T_FMT_AMPM - a.m. or p.m. time formatting string 5 - AM_STR - Ante Meridian affix 6 - PM_STR - Post Meridian affix The week day names: 7 - DAY_1 - sunday in the local language 8 - DAY_2 - monday in the local language 9 - DAY_3 - tuesday in the local language 10 - DAY_4 - wednesday in the local language 11 - DAY_5 - thursday in the local language 12 - DAY_6 - friday in the local language 13 - DAY_7 - saturday in the local language The abbreviated week day names: 14 - ABDAY_1 - sun in the local language 15 - ABDAY_2 - mon in the local language 16 - ABDAY_3 - tue in the local language 17 - ABDAY_4 - wed in the local language 18 - ABDAY_5 - thu in the local language 19 - ABDAY_6 - fri in the local language 20 - ABDAY_7 - sat in the local language It's exactly the same standard for months: 21 to 32 - MON_1 to MON_12 33 to 44 - ABMON_1 to ABMON_12 Now, some era informations: 45 - ERA - era description segments 46 - ERA_D_FMT - era date format string 47 - ERA_D_T_FMT - era date and time format string 48 - ERA_T_FMT - era time format string 49 - ALT_DIGITS - alternative symbols for digits Symbols: 50 - RADIXCHAR - radix char 51 - THOUSEP - separator for thousands I think these 2 variables very useful: 52 - YESEXPR - affirmative response regexp 53 - NOEXPR - negative response regexp On some systems, you have also more variables. Here in FreeBSD: 54 - YESSTR - affirmative response for yes/no queries 55 - NOSTR - negative response for yes/no queries 56 - CRNCYSTR - currency symbol (hmmm ... euro is '+Eu' instead the € (&euro;) even with an ISO codeset managing euro symbol (ISO8859-15)) 57 - D_MD_ORDER - month/day order In NetBSD, we start directly with D_T_FMT, so you have to subtract 1 to the first serie of codes. After, the order change. Some variables are not defined in all LOCALE. For exemple, in locale fr_BE.ISO8859-15 (French-speaking Belgium), 4 to 6 are void because hours are exprimed in 24 hours format. The best method to give an idea of the function is to print all results : <pre> <?php setlocale (LC_ALL, 'fr_BE.ISO8859-15'); for ($i = 0 ; $i < 58 ; $i++) { printf("\n%2d - ", $i); echo nl_langinfo($i); } ?> </pre> ---- Manual Page -- http://www.php.net/manual/en/function.nl-langinfo.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39127 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39127&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39127&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63760) next »