Blame lib/Date/Manip/Lang.pod

Packit 95306a
# Copyright (c) 1995-2017 Sullivan Beck. All rights reserved.
Packit 95306a
# This program is free software; you can redistribute it and/or modify it
Packit 95306a
# under the same terms as Perl itself.
Packit 95306a
Packit 95306a
=pod
Packit 95306a
Packit 95306a
=head1 NAME
Packit 95306a
Packit 95306a
Date::Manip::Lang - language support for Date::Manip
Packit 95306a
Packit 95306a
=head1 DESCRIPTION
Packit 95306a
Packit 95306a
Date::Manip supports a number of different languages when
Packit 95306a
parsing dates, and more can be added.
Packit 95306a
Packit 95306a
=head1 CURRENT LANGUAGES
Packit 95306a
Packit 95306a
Currently, the following languages are supported by Date::Manip.
Packit 95306a
The version of Date::Manip where they were added is included (so
Packit 95306a
you can see the minimum version of Date::Manip needed to parse
Packit 95306a
each).
Packit 95306a
Packit 95306a
The language can be chosen by setting the Language config
Packit 95306a
variable to the name of the language or any of the aliases
Packit 95306a
included in the table.
Packit 95306a
Packit 95306a
All names and aliases are case insensitive.
Packit 95306a
Packit 95306a
   Language     Version  Aliases
Packit 95306a
Packit 95306a
   English      default  en, en_us
Packit 95306a
Packit 95306a
   Catalan      5.43     ca
Packit 95306a
   Danish       5.41     da
Packit 95306a
   Dutch        5.32     Nederlands, nl
Packit 95306a
   Finnish      6.31     fi, fi_fi
Packit 95306a
   French       5.02     fr, fr_fr
Packit 95306a
   German       5.31     de, de_de
Packit 95306a
   Italian      5.35     it, it_it
Packit 95306a
   Norwegian    6.21     nb, nb_no
Packit 95306a
   Polish       5.32     pl, pl_pl
Packit 95306a
   Portuguese   5.34     pt, pt_pt
Packit 95306a
   Romanian     5.35     ro, ro_ro
Packit 95306a
   Russian      5.41     ru, ru_ru
Packit 95306a
   Spanish      5.33     es, es_es
Packit 95306a
   Swedish      5.05     sv
Packit 95306a
   Turkish      5.41     tr, tr_tr
Packit 95306a
Packit 95306a
=head1 ADDING A LANGUAGE
Packit 95306a
Packit 95306a
Adding a language is easily done (if you're fluent in both English
Packit 95306a
and the other language).  If you want to add a new language, do the
Packit 95306a
following:
Packit 95306a
Packit 95306a
=over 4
Packit 95306a
Packit 95306a
=item Language name
Packit 95306a
Packit 95306a
When you submit the new language, I'll need the name of the
Packit 95306a
language (of course) and any common locale names that might
Packit 95306a
be useful for people to select the language.
Packit 95306a
Packit 95306a
For example, if you were creating a Spanish translation (which is not
Packit 95306a
necessary since it already exists), I would need the following list:
Packit 95306a
Packit 95306a
   spanish es es_es
Packit 95306a
Packit 95306a
=item Copy the english module
Packit 95306a
Packit 95306a
Copy the english.pm file (which is in lib/Date/Manip/Lang in the
Packit 95306a
Date::Manip distribution) to the new language (i.e. spanish.pm in
Packit 95306a
this example).
Packit 95306a
Packit 95306a
=item Set some variables in the new module
Packit 95306a
Packit 95306a
The new module (spanish.pm) will need a few simple modifications.
Packit 95306a
Change the package name from 'english' to 'spanish'.
Packit 95306a
Packit 95306a
Fix the C<@Encodings> lines.  Most languages can be written in more
Packit 95306a
than one encoding.  The first encoding in the list should be utf-8
Packit 95306a
and the last should be perl.  Include any other encodings that
Packit 95306a
should be supported as well.
Packit 95306a
Packit 95306a
Set the C<$YearAdded> and C<$LangName> appropriately.
Packit 95306a
Packit 95306a
=item Translate the language terms
Packit 95306a
Packit 95306a
The data section of the module is fairly straightforward to translate.
Packit 95306a
Packit 95306a
Every term is defined in the L<Date::Manip::Lang::english> document
Packit 95306a
(or in any of the other language module documents), so please
Packit 95306a
refer to it to find out what each element means.  Then replace the
Packit 95306a
English version with the new translation.
Packit 95306a
Packit 95306a
There are some requirements:
Packit 95306a
Packit 95306a
1) Every element should be defined (except for the sephm and sepms
Packit 95306a
elements which are optional).
Packit 95306a
Packit 95306a
2) The module must be written using UTF-8 characters if the language
Packit 95306a
includes any non-ASCII characters.
Packit 95306a
Packit 95306a
3) Each element includes a list of values (different variations of the
Packit 95306a
element).  In most cases, the order of the values for each element is
Packit 95306a
not important since they are just used to create a regular expression
Packit 95306a
for parsing dates, but a few of them are also used to determine printable
Packit 95306a
values using the C<Date::Manip::Date::printf> method (or the C<UnixDate>
Packit 95306a
function).  These elements are:
Packit 95306a
Packit 95306a
   Element       printf directive
Packit 95306a
Packit 95306a
   ampm          %p
Packit 95306a
   day_abb       %a
Packit 95306a
   day_char      %v
Packit 95306a
   day_name      %A
Packit 95306a
   month_abb     %b
Packit 95306a
   month_name    %B
Packit 95306a
   nth           %E
Packit 95306a
Packit 95306a
For each of these, the value that should be printed out must be the
Packit 95306a
first value in the list.
Packit 95306a
Packit 95306a
4) When possible, if a language includes characters that are
Packit 95306a
essentially ASCII characters with a punctuation mark, please include a
Packit 95306a
variation of the value which is just ASCII with the punctuation
Packit 95306a
removed.  For example, the spanish name for Saturday in ASCII would be
Packit 95306a
written sabado, but in reality, the first 'a' has an accent over
Packit 95306a
it. This word should appear twice... first in full UTF-8 encoding, and
Packit 95306a
second as all ASCII. If the language (Russian for example) has no
Packit 95306a
ASCII equivalent, just include the UTF-8 representation.
Packit 95306a
Packit 95306a
=back
Packit 95306a
Packit 95306a
Feel free to contact me if you have any questions.
Packit 95306a
Packit 95306a
=head1 SEE ALSO
Packit 95306a
Packit 95306a
L<Date::Manip>        - main module documentation
Packit 95306a
Packit 95306a
=head1 LICENSE
Packit 95306a
Packit 95306a
This script is free software; you can redistribute it and/or
Packit 95306a
modify it under the same terms as Perl itself.
Packit 95306a
Packit 95306a
=head1 AUTHOR
Packit 95306a
Packit 95306a
Sullivan Beck (sbeck@cpan.org)
Packit 95306a
Packit 95306a
=cut