{
    "mode": "perldoc",
    "parameter": "DateTime::Locale",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/DateTime%3A%3ALocale/json",
    "generated": "2026-06-10T04:37:49Z",
    "synopsis": "use DateTime::Locale;\nmy $loc = DateTime::Locale->load('en-GB');\nprint $loc->nativename, \"\\n\", $loc->datetimeformatlong, \"\\n\";\n# but mostly just things like ...\nmy $dt = DateTime->now( locale => 'fr' );\nprint \"Aujourd'hui le mois est \" . $dt->monthname, \"\\n\";",
    "sections": {
        "NAME": {
            "content": "DateTime::Locale - Localization support for DateTime.pm\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 1.33\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use DateTime::Locale;\n\nmy $loc = DateTime::Locale->load('en-GB');\n\nprint $loc->nativename, \"\\n\", $loc->datetimeformatlong, \"\\n\";\n\n# but mostly just things like ...\n\nmy $dt = DateTime->now( locale => 'fr' );\nprint \"Aujourd'hui le mois est \" . $dt->monthname, \"\\n\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "DateTime::Locale is primarily a factory for the various locale subclasses. It also provides some\nfunctions for getting information on all the available locales.\n\nIf you want to know what methods are available for locale objects, then please read the\nDateTime::Locale::FromData documentation.\n",
            "subsections": []
        },
        "USAGE": {
            "content": "This module provides the following class methods:\n\nDateTime::Locale->load( $localecode | $localename )\nReturns the locale object for the specified locale code or name - see the\nDateTime::Locale::Catalog documentation for the list of available codes and names. The name\nprovided may be either the English or native name.\n\nIf the requested locale is not found, a fallback search takes place to find a suitable\nreplacement.\n\nThe fallback search order is:\n\n{language}-{script}-{territory}\n{language}-{script}\n{language}-{territory}-{variant}\n{language}-{territory}\n{language}\n\nEg. For the locale code \"es-XX-UNKNOWN\" the fallback search would be:\n\nes-XX-UNKNOWN   # Fails - no such locale\nes-XX           # Fails - no such locale\nes              # Found - the es locale is returned as the\n# closest match to the requested id\n\nEg. For the locale code \"es-Latn-XX\" the fallback search would be:\n\nes-Latn-XX      # Fails - no such locale\nes-Latn         # Fails - no such locale\nes-XX           # Fails - no such locale\nes              # Found - the es locale is returned as the\n# closest match to the requested id\n\nIf no suitable replacement is found, then an exception is thrown.\n\nThe loaded locale is cached, so that locale objects may be singletons. Calling\n\"DateTime::Locale->registerfromdata\", \"DateTime::Locale->addaliases\", or\n\"DateTime::Locale->removealias\" clears the cache.\n\nDateTime::Locale->codes\nmy @codes = DateTime::Locale->codes;\nmy $codes = DateTime::Locale->codes;\n\nReturns an unsorted list of the available locale codes, or an array reference if called in a\nscalar context. This list does not include aliases.\n\nDateTime::Locale->names\nmy @names = DateTime::Locale->names;\nmy $names = DateTime::Locale->names;\n\nReturns an unsorted list of the available locale names in English, or an array reference if\ncalled in a scalar context.\n\nDateTime::Locale->nativenames\nmy @names = DateTime::Locale->nativenames;\nmy $names = DateTime::Locale->nativenames;\n\nReturns an unsorted list of the available locale names in their native language, or an array\nreference if called in a scalar context. All native names use UTF-8 as appropriate.\n\nDateTime::Locale->registerfromdata( $localedata )\nThis method allows you to register a custom locale. The data for the locale is specified as a\nhash (or hashref) where the keys match the method names given in DateTime::Locale::FromData.\n\nIf you just want to make some small changes on top of an existing locale you can get that\nlocale's data by calling \"$locale->localedata\".\n\nHere is an example of making a custom locale based off of \"en-US\":\n\nmy $locale = DateTime::Locale->load('en-US');\nmy %data   = $locale->localedata;\n$data{code}               = 'en-US-CUSTOM';\n$data{timeformatmedium} = 'HH:mm:ss';\n\nDateTime::Locale->registerfromdata(%data);\n\n# Prints 18:24:38\nsay DateTime->now( locale => 'en-US-CUSTOM' )->strftime('%X');\n\n# Prints 6:24:38 PM\nsay DateTime->now( locale => 'en-US' )->strftime('%X');\n\nThe keys that should be present in the hash are the same as the accessor methods provided by\nDateTime::Locale::FromData, except for the following:\n\nThe *code methods\nWhile you should provide a \"code\" key, the other methods like \"languagecode\" and\n\"scriptcode\" are determined by parsing the code.\n\nAll \"id\" returning methods\nThese are aliases for the corresponding *code methods.\n\n\"prefers24hourtime\"\nThis is determined by looking at the short time format to see how it formats hours,\n\n\"dateformatdefault\" and \"timeformatdefault\"\nThese are the corresponding medium formats.\n\n\"datetimeformat\" and \"datetimeformatdefault\"\nThis is the same as the medium format.\n\n\"dateformats\" and \"timeformats\"\nThese are calculated as needed.\n\n\"availableformats\"\nThis should be provided as a hashref where the keys are things like \"Gy\" or \"MMMEd\" and the\nvalues are an actual format like \"y G\" or \"E, MMM d\".\n\n\"localedata\"\nThis is everything you pass in.\n",
            "subsections": []
        },
        "LOADING LOCALES IN A PRE-FORKING SYSTEM": {
            "content": "If you are running an application that does pre-forking (for example with Starman), then you\nshould try to load all the locales that you'll need in the parent process. Locales are loaded\non-demand, so loading them once in each child will waste memory that could otherwise be shared.\n",
            "subsections": []
        },
        "CLDR DATA BUGS": {
            "content": "Please be aware that all locale data has been generated from the CLDR (Common Locale Data\nRepository) project locales data). The data is incomplete, and may contain errors in some\nlocales.\n\nWhen reporting errors in data, please check the primary data sources first, then where necessary\nreport errors directly to the primary source via the CLDR bug report system. See\n<http://unicode.org/cldr/filingbugreports.html> for details.\n\nOnce these errors have been confirmed, please forward the error report and corrections to the\nDateTime mailing list, datetime@perl.org.\n",
            "subsections": []
        },
        "AUTHOR EMERITUS": {
            "content": "Richard Evans wrote the first version of DateTime::Locale, including the tools to extract the\nCLDR data.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "datetime@perl.org mailing list\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Bugs may be submitted at <https://github.com/houseabsolute/DateTime-Locale/issues>.\n\nThere is a mailing list available for users of this distribution, <mailto:datetime@perl.org>.\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "The source code repository for DateTime-Locale can be found at\n<https://github.com/houseabsolute/DateTime-Locale>.\n",
            "subsections": []
        },
        "DONATIONS": {
            "content": "If you'd like to thank me for the work I've done on this module, please consider making a\n\"donation\" to me via PayPal. I spend a lot of free time creating free software, and would\nappreciate any support you'd care to offer.\n\nPlease note that I am not suggesting that you must do this in order for me to continue working\non this particular software. I will continue to do so, inasmuch as I have in the past, for as\nlong as it interests me.\n\nSimilarly, a donation made in this way will probably not make me work on this software much\nmore, unless I get so many donations that I can consider working on free software full time\n(let's all have a chuckle at that together).\n\nTo donate, log into PayPal and send money to autarch@urth.org, or use the button at\n<https://www.urth.org/fs-donation.html>.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Dave Rolsky <autarch@urth.org>\n",
            "subsections": []
        },
        "CONTRIBUTORS": {
            "content": "*   Alexander Pankoff <ccntrq@screenri.de>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   Mohammad S Anwar <mohammad.anwar@yahoo.com>\n\n*   Ryley Breiddal <rbreiddal@presinet.com>\n\n*   Sergey Leschenko <Sergey.Leschenko@portaone.com>\n\n*   yasu47b <nakayamayasuhiro1986@gmail.com>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2003 - 2021 by Dave Rolsky.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n\nThe full text of the license can be found in the LICENSE file included with this distribution.\n",
            "subsections": []
        }
    },
    "summary": "DateTime::Locale - Localization support for DateTime.pm",
    "flags": [],
    "examples": [],
    "see_also": []
}