Date::Manip::Lang(3)
π Date::Manip::Lang(3) π
okay bestie, so this is the User Contributed Perl Documentation page for Date::Manip::Lang, and it's literally the language-support lore drop for Date::Manip. pull up a chair π«Ά
β¨ NAME β¨
Date::Manip::Lang β language support for Date::Manip π¦
πΈ DESCRIPTION πΈ
Date::Manip speaks a whole bunch of languages when it's parsing dates, and you can absolutely add more. it's giving polyglot main character energy, no cap π
π CURRENT LANGUAGES π
so rn, Date::Manip supports these languages. the version where each one got added is right there too (that's your minimum Date::Manip version needed to parse each one, iykyk).
you pick your language by setting the Language config variable to the name of the language, or literally any of the aliases listed below. iconic.
all names and aliases are case insensitive. periodt.
- English β version: default β aliases:
en,en_us - Catalan β version: 5.43 β aliases:
ca - Danish β version: 5.41 β aliases:
da - Dutch β version: 5.32 β aliases:
Nederlands,nl - Finnish β version: 6.31 β aliases:
fi,fi_fi - French β version: 5.02 β aliases:
fr,fr_fr - German β version: 5.31 β aliases:
de,de_de - Italian β version: 5.35 β aliases:
it,it_it - Norwegian β version: 6.21 β aliases:
nb,nb_no - Polish β version: 5.32 β aliases:
pl,pl_pl - Portuguese β version: 5.34 β aliases:
pt,pt_pt - Romanian β version: 5.35 β aliases:
ro,ro_ro - Russian β version: 5.41 β aliases:
ru,ru_ru - Spanish β version: 5.33 β aliases:
es,es_es - Swedish β version: 5.05 β aliases:
sv - Turkish β version: 5.41 β aliases:
tr,tr_tr
π ADDING A LANGUAGE π
adding a language is lowkey easy (as long as you're fluent in both English and the other language, obviously π ). if you wanna add a new language, here's the whole recipe:
π Language name
when you submit your new language, I'm gonna need the name of the language (duh) plus any common locale names that people might wanna use to select it.
like, say you were making a Spanish translation (not that you need to, bestie, it already exists π), I'd need this list:
spanish es es_es
π Copy the english module
copy the english.pm file (it lives in lib/Date/Manip/Lang in the Date::Manip distribution) over to your new language, i.e. spanish.pm in this example. slay.
π Set some variables in the new module
your new module (spanish.pm) needs a few lil tweaks:
- change the package name from
'english'to'spanish'. - fix the
@Encodingslines. most languages can be written in more than one encoding. the first encoding in the list should beutf-8and the last should beperl. include any other encodings that should be supported too. - set
$YearAddedand$LangNameappropriately. π
π Translate the language terms
the data section of the module is pretty straightforward to translate, fr fr.
every term is defined in the Date::Manip::Lang::english document (or in any of the other language module documents), so go peek at it to find out what each element means. then swap the English version for your new translation. π¦
there are some requirements tho:
- every element should be defined (except for the
sephmandsepmselements, which are optional). - the module must be written using UTF-8 characters if the language includes any non-ASCII characters.
- each element includes a list of values (different variations of the element). in most cases, the order of the values for each element doesn't matter, since they're just used to create a regular expression for parsing dates. BUT a few of them are also used to determine printable values using the
Date::Manip::Date::printfmethod (or theUnixDatefunction). those elements are:ampmβ printf directive%pday_abbβ printf directive%aday_charβ printf directive%vday_nameβ printf directive%Amonth_abbβ printf directive%bmonth_nameβ printf directive%Bnthβ printf directive%E
for each of these, the value that should be printed out must be the first value in the list. no skipping, bestie.
- when possible, if a language includes characters that are basically ASCII characters with a punctuation mark, please include a variation of the value that's just ASCII with the punctuation removed. for example, the spanish name for Saturday in ASCII would be written
sabado, but in reality the first'a'has an accent over it. this word should appear twice⦠first in full UTF-8 encoding, and second as all ASCII. if the language (Russian, for example) has no ASCII equivalent, just include the UTF-8 representation.
feel free to contact me if you have any questions. π«Ά
β LANGUAGE SPECIFIC RULES β
in the language file there's one special value named _special_rules. it's a hash of special parsing rules that get applied for that language.
rn these are the rules available:
π remove_trailing_period
if this is set, trailing periods get removed.
for example, in German, the default output of the date command includes a day of month with a trailing period. like:
Mo 3. Jan 11:00:00 EST 2022
if this rule is set, periods followed by whitespace (or an end of string) are stripped.
π remove_parens
this will strip parentheses () from a string.
π strip_word
this is a list of words that will be stripped from a string. each word must be bracketed by the start/end of the string or whitespace.
π SEE ALSO π
Date::Manipβ main module documentation
π LICENSE π
this script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. (yes queen, go off π)
π AUTHOR π
Sullivan Beck (https://github.com/SBECK-github/)
and that's the whole vibe check, bestie πβ¨ this was brought to you by perl v5.42.3, dated 2026-09-01, from the Date::Manip::Lang(3) era. go parse something gorgeous π¦ππ
π¦ where this page comes from
- fedora 43: perl-Date-Manip 7.00-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Date-Manip 7.00-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms