Skip to content

Instantly share code, notes, and snippets.

@henriquemoody
Last active December 20, 2015 06:59
Show Gist options
  • Save henriquemoody/6089648 to your computer and use it in GitHub Desktop.
Save henriquemoody/6089648 to your computer and use it in GitHub Desktop.
nl_langinfo() constant values.
<?php
$langinfo = array(
'LC_TIME' => array(
'ABDAY_1' => 'Abbreviated name of fist day of the week',
'ABDAY_2' => 'Abbreviated name of second day of the week',
'ABDAY_3' => 'Abbreviated name of third day of the week',
'ABDAY_4' => 'Abbreviated name of fourth day of the week',
'ABDAY_5' => 'Abbreviated name of fifth day of the week',
'ABDAY_6' => 'Abbreviated name of sixth day of the week',
'ABDAY_7' => 'Abbreviated name of seventh day of the week',
'DAY_1' => 'Name of fist day of the week',
'DAY_2' => 'Name of second day of the week',
'DAY_3' => 'Name of third day of the week',
'DAY_4' => 'Name of fourth day of the week',
'DAY_5' => 'Name of fifth day of the week',
'DAY_6' => 'Name of sixth day of the week',
'DAY_7' => 'Name of seventh day of the week',
'ABMON_1' => 'Abbreviated name of the first month of the year',
'ABMON_2' => 'Abbreviated name of the second month of the year',
'ABMON_3' => 'Abbreviated name of the third month of the year',
'ABMON_4' => 'Abbreviated name of the fourth month of the year',
'ABMON_5' => 'Abbreviated name of the fifth month of the year',
'ABMON_6' => 'Abbreviated name of the sixth month of the year',
'ABMON_7' => 'Abbreviated name of the seventh month of the year',
'ABMON_8' => 'Abbreviated name of the eighth month of the year',
'ABMON_9' => 'Abbreviated name of the ninth month of the year',
'ABMON_10' => 'Abbreviated name of the tenth month of the year',
'ABMON_11' => 'Abbreviated name of the eleventh month of the year',
'ABMON_12' => 'Abbreviated name of the twelfth month of the year',
'MON_1' => 'Name of the first month of the year',
'MON_2' => 'Name of the second month of the year',
'MON_3' => 'Name of the third month of the year',
'MON_4' => 'Name of the fourth month of the year',
'MON_5' => 'Name of the fifth month of the year',
'MON_6' => 'Name of the sixth month of the year',
'MON_7' => 'Name of the seventh month of the year',
'MON_8' => 'Name of the eighth month of the year',
'MON_9' => 'Name of the ninth month of the year',
'MON_10' => 'Name of the tenth month of the year',
'MON_11' => 'Name of the eleventh month of the year',
'MON_12' => 'Name of the twelfth month of the year',
'AM_STR' => 'String for Ante meridian',
'PM_STR' => 'String for Post meridian',
'D_T_FMT' => 'String that can be used as the format string for strftime() to represent time and date',
'D_FMT' => 'String that can be used as the format string for strftime() to represent date',
'T_FMT' => 'String that can be used as the format string for strftime() to represent time',
'T_FMT_AMPM' => 'String that can be used as the format string for strftime() to represent time in 12-hour format with ante/post meridian',
'ERA' => 'Alternate era',
'ERA_YEAR' => 'Year in alternate era format',
'ERA_D_T_FMT' => 'Date and time in alternate era format (string can be used in strftime())',
'ERA_D_FMT' => 'Date in alternate era format (string can be used in strftime())',
'ERA_T_FMT' => 'Time in alternate era format (string can be used in strftime())',
),
'LC_MONETARY' => array(
'INT_CURR_SYMBOL' => 'International currency symbol',
'CURRENCY_SYMBOL' => 'Local currency symbol',
'CRNCYSTR' => 'Same value as CURRENCY_SYMBOL',
'MON_DECIMAL_POINT' => 'Decimal point character',
'MON_THOUSANDS_SEP' => 'Thousands separator (groups of three digits)',
'MON_GROUPING' => 'Like "grouping" element',
'POSITIVE_SIGN' => 'Sign for positive values',
'NEGATIVE_SIGN' => 'Sign for negative values',
'INT_FRAC_DIGITS' => 'International fractional digits',
'FRAC_DIGITS' => 'Local fractional digits',
'P_CS_PRECEDES' => 'Returns 1 if CURRENCY_SYMBOL precedes a positive value',
'P_SEP_BY_SPACE' => 'Returns 1 if a space separates CURRENCY_SYMBOL from a positive value',
'N_CS_PRECEDES' => 'Returns 1 if CURRENCY_SYMBOL precedes a negative value',
'N_SEP_BY_SPACE' => 'Returns 1 if a space separates CURRENCY_SYMBOL from a negative value',
'P_SIGN_POSN' => 'P_SIGN_POSN',
'N_SIGN_POSN' => 'N_SIGN_POSN',
),
'LC_NUMERIC' => array(
'DECIMAL_POINT' => 'Decimal point character',
'RADIXCHAR' => 'Same value as DECIMAL_POINT',
'THOUSANDS_SEP' => 'Separator character for thousands (groups of three digits)',
'THOUSEP' => 'Same value as THOUSANDS_SEP',
'GROUPING' => 'GROUPING',
),
'LC_MESSAGES' => array(
'YESEXPR' => 'Regex string for matching "yes" input',
'NOEXPR' => 'Regex string for matching "no" input',
'YESSTR' => 'Output string for "yes"',
'NOSTR' => 'Output string for "no"',
),
'LC_CTYPE' => array(
'CODESET' => 'Return a string with the name of the character encoding'
),
);
setlocale(LC_ALL, isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'pt_BR');
foreach ($langinfo as $category => $constants) {
if (isset($_SERVER['argv'][2]) && $_SERVER['argv'][2] != $category) {
continue;
}
echo $category . PHP_EOL;
echo str_repeat('=', 80), PHP_EOL;
foreach ($constants as $constantName => $description) {
if (false === defined($constantName)) {
continue;
}
$constantValue = constant($constantName);
echo $description . '. [' . $constantName . ' => ' . $constantValue . ']' . PHP_EOL;
echo "\t" . nl_langinfo($constantValue) . PHP_EOL;
echo PHP_EOL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment