1Date::Manip::Lang(3) User Contributed Perl Documentation Date::Manip::Lang(3)
2
3
4
6 Date::Manip::Lang - language support for Date::Manip
7
9 Date::Manip supports a number of different languages when parsing
10 dates, and more can be added.
11
13 Currently, the following languages are supported by Date::Manip. The
14 version of Date::Manip where they were added is included (so you can
15 see the minimum version of Date::Manip needed to parse each).
16
17 The language can be chosen by setting the Language config variable to
18 the name of the language or any of the aliases included in the table.
19
20 All names and aliases are case insensitive.
21
22 Language Version Aliases
23
24 English default en, en_us
25
26 Catalan 5.43 ca
27 Danish 5.41 da
28 Dutch 5.32 Nederlands, nl
29 Finnish 6.31 fi, fi_fi
30 French 5.02 fr, fr_fr
31 German 5.31 de, de_de
32 Italian 5.35 it, it_it
33 Norwegian 6.21 nb, nb_no
34 Polish 5.32 pl, pl_pl
35 Portuguese 5.34 pt, pt_pt
36 Romanian 5.35 ro, ro_ro
37 Russian 5.41 ru, ru_ru
38 Spanish 5.33 es, es_es
39 Swedish 5.05 sv
40 Turkish 5.41 tr, tr_tr
41
43 Adding a language is easily done (if you're fluent in both English and
44 the other language). If you want to add a new language, do the
45 following:
46
47 Language name
48 When you submit the new language, I'll need the name of the
49 language (of course) and any common locale names that might be
50 useful for people to select the language.
51
52 For example, if you were creating a Spanish translation (which is
53 not necessary since it already exists), I would need the following
54 list:
55
56 spanish es es_es
57
58 Copy the english module
59 Copy the english.pm file (which is in lib/Date/Manip/Lang in the
60 Date::Manip distribution) to the new language (i.e. spanish.pm in
61 this example).
62
63 Set some variables in the new module
64 The new module (spanish.pm) will need a few simple modifications.
65 Change the package name from 'english' to 'spanish'.
66
67 Fix the @Encodings lines. Most languages can be written in more
68 than one encoding. The first encoding in the list should be utf-8
69 and the last should be perl. Include any other encodings that
70 should be supported as well.
71
72 Set the $YearAdded and $LangName appropriately.
73
74 Translate the language terms
75 Translate all of the data (after the __DATA__ line).
76
77 The data section of the module (which is written in YAML) is fairly
78 straightforward to translate.
79
80 Every term is defined in the Date::Manip::Lang::english document
81 (or in any of the other language module documents), so please refer
82 to it to find out what each element means. Then replace the
83 English version with the new translation.
84
85 There are some requirements:
86
87 1) Every element should be defined (except for the sephm and sepms
88 elements).
89
90 2) The module must be written using UTF-8 characters if the
91 language includes any non-ASCII characters.
92
93 3) Each element includes a list of values (different variations of
94 the element). In most cases, the order of the values for each
95 element is not important since they are just used to create a
96 regular expression for parsing dates, but a few of them are also
97 used to determine printable values using the
98 Date::Manip::Date::printf method (or the UnixDate function). These
99 elements are:
100
101 Element printf directive
102
103 ampm %p
104 day_abb %a
105 day_char %v
106 day_name %A
107 month_abb %b
108 month_name %B
109 nth %E
110
111 For each of these, the value that should be printed out must be the
112 first value in the list.
113
114 4) When possible, if a language includes characters that are
115 essentially ASCII characters with a punctuation mark, please
116 include a variation of the value which is just ASCII with the
117 punctuation removed. For example, the spanish name for Saturday in
118 ASCII would be written sabado, but in reality, the first 'a' has an
119 accent over it. This word should appear twice... first in full
120 UTF-8 encoding, and second as all ASCII. If the language (Russian
121 for example) has no ASCII equivalent, just include the UTF-8
122 representation.
123
124 Feel free to contact me if you have any questions.
125
127 Date::Manip - main module documentation
128
130 This script is free software; you can redistribute it and/or modify it
131 under the same terms as Perl itself.
132
134 Sullivan Beck (sbeck@cpan.org)
135
136
137
138perl v5.16.3 2014-06-09 Date::Manip::Lang(3)