{
    "mode": "perldoc",
    "parameter": "I18N::Langinfo",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/I18N%3A%3ALanginfo/json",
    "generated": "2026-06-12T11:02:41Z",
    "synopsis": "use I18N::Langinfo;",
    "sections": {
        "NAME": {
            "content": "I18N::Langinfo - query locale information\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use I18N::Langinfo;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The langinfo() function queries various locale information that can be used to localize output\nand user interfaces. It uses the current underlying locale, regardless of whether or not it was\ncalled from within the scope of \"use locale\". The langinfo() function requires one numeric\nargument that identifies the locale constant to query: if no argument is supplied, $ is used.\nThe numeric constants appropriate to be used as arguments are exportable from I18N::Langinfo.\n\nThe following example will import the langinfo() function itself and three constants to be used\nas arguments to langinfo(): a constant for the abbreviated first day of the week (the numbering\nstarts from Sunday = 1) and two more constants for the affirmative and negative answers for a\nyes/no question in the current locale.\n\nuse I18N::Langinfo qw(langinfo ABDAY1 YESSTR NOSTR);\n\nmy ($abday1, $yesstr, $nostr) =\nmap { langinfo($) } (ABDAY1, YESSTR, NOSTR);\n\nprint \"$abday1? [$yesstr/$nostr] \";\n\nIn other words, in the \"C\" (or English) locale the above will probably print something like:\n\nSun? [yes/no]\n\nbut under a French locale\n\ndim? [oui/non]\n\nThe usually available constants are as follows.\n\n*   For abbreviated and full length days of the week and months of the year:\n\nABDAY1 ABDAY2 ABDAY3 ABDAY4 ABDAY5 ABDAY6 ABDAY7\nABMON1 ABMON2 ABMON3 ABMON4 ABMON5 ABMON6\nABMON7 ABMON8 ABMON9 ABMON10 ABMON11 ABMON12\nDAY1 DAY2 DAY3 DAY4 DAY5 DAY6 DAY7\nMON1 MON2 MON3 MON4 MON5 MON6\nMON7 MON8 MON9 MON10 MON11 MON12\n\n*   For the date-time, date, and time formats used by the strftime() function (see POSIX):\n\nDTFMT DFMT TFMT\n\n*   For the locales for which it makes sense to have ante meridiem and post meridiem time\nformats:\n\nAMSTR PMSTR TFMTAMPM\n\n*   For the character code set being used (such as \"ISO8859-1\", \"cp850\", \"koi8-r\", \"sjis\",\n\"utf8\", etc.), and for the currency string:\n\nCODESET CRNCYSTR\n\n*   For an alternate representation of digits, for the radix character used between the integer\nand the fractional part of decimal numbers, the group separator string for large-ish\nfloating point numbers (yes, the final two are redundant with POSIX::localeconv()):\n\nALTDIGITS RADIXCHAR THOUSEP\n\n*   For the affirmative and negative responses and expressions:\n\nYESSTR YESEXPR NOSTR NOEXPR\n\n*   For the eras based on typically some ruler, such as the Japanese Emperor (naturally only\ndefined in the appropriate locales):\n\nERA ERADFMT ERADTFMT ERATFMT\n\nFor systems without \"nllanginfo\"\nStarting in Perl 5.28, this module is available even on systems that lack a native\n\"nllanginfo\". On such systems, it uses various methods to construct what that function, if\npresent, would return. But there are potential glitches. These are the items that could be\ndifferent:\n\n\"ERA\"\nUnimplemented, so returns \"\".\n\n\"CODESET\"\nUnimplemented, except on Windows, due to the vagaries of vendor locale names, returning \"\"\non non-Windows.\n\n\"YESEXPR\"\n\"YESSTR\"\n\"NOEXPR\"\n\"NOSTR\"\nOnly the values for English are returned. \"YESSTR\" and \"NOSTR\" have been removed from POSIX\n2008, and are retained here for backwards compatibility. Your platform's \"nllanginfo\" may\nnot support them.\n\n\"DFMT\"\nAlways evaluates to %x, the locale's appropriate date representation.\n\n\"TFMT\"\nAlways evaluates to %X, the locale's appropriate time representation.\n\n\"DTFMT\"\nAlways evaluates to %c, the locale's appropriate date and time representation.\n\n\"CRNCYSTR\"\nThe return may be incorrect for those rare locales where the currency symbol replaces the\nradix character. Send email to <mailto:perlbug@perl.org> if you have examples of it needing\nto work differently.\n\n\"ALTDIGITS\"\nCurrently this gives the same results as Linux does. Send email to <mailto:perlbug@perl.org>\nif you have examples of it needing to work differently.\n\n\"ERADFMT\"\n\"ERATFMT\"\n\"ERADTFMT\"\n\"TFMTAMPM\"\nThese are derived by using \"strftime()\", and not all versions of that function know about\nthem. \"\" is returned for these on such systems.\n\nSee your nllanginfo(3) for more information about the available constants. (Often this means\nhaving to look directly at the langinfo.h C header file.)\n\nEXPORT\nBy default only the \"langinfo()\" function is exported.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Before Perl 5.28, the returned values are unreliable for the \"RADIXCHAR\" and \"THOUSEP\" locale\nconstants.\n\nStarting in 5.28, changing locales on threaded builds is supported on systems that offer\nthread-safe locale functions. These include POSIX 2008 systems and Windows starting with Visual\nStudio 2005, and this module will work properly in such situations. However, on threaded builds\non Windows prior to Visual Studio 2015, retrieving the items \"CRNCYSTR\" and \"THOUSEP\" can result\nin a race with a thread that has converted to use the global locale. It is quite uncommon for a\nthread to have done this. It would be possible to construct a workaround for this; patches\nwelcome: see \"switchtogloballocale\" in perlapi.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perllocale, \"localeconv\" in POSIX, \"setlocale\" in POSIX, nllanginfo(3).\n\nThe langinfo() function is just a wrapper for the C nllanginfo() interface.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Jarkko Hietaniemi, <jhi@hut.fi>. Now maintained by Perl 5 porters.\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "Copyright 2001 by Jarkko Hietaniemi\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "I18N::Langinfo - query locale information",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "nllanginfo",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/nllanginfo/3/json"
        }
    ]
}