The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Locale - Role providing interface for localization of revolutionary date built by App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate.

VERSION

version 0.26

DESCRIPTION

This role defines the localization interface for App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate.

It provides some methods copied from DateTime::Calendar::FrenchRevolutionary::Locale::fr.

Any class consuming this role is required to overload every mandatory attribute with a default in the language of that class:

months

Default for this attribute should be a sorted array reference of 13 strings, each of them translating the name of each month ('Vendémiaire', 'Brumaire', 'Frimaire', 'Nivôse', 'Pluviôse', 'Ventôse', 'Germinal', 'Floréal', 'Prairial', 'Messidor', 'Thermidor', and 'Fructidor' in French), along with a last pseudo-month (jour complémentaire in French) holding the five additional days (or six on leap years), also called "sans-culottides", added after Fructidor. E.g.:

  has '+months' => (
    default => sub {[
      'Vendémiaire', 'Brumaire',  'Frimaire',
      'Nivôse',      'Pluviôse',  'Ventôse',
      'Germinal',    'Floréal',   'Prairial',
      'Messidor',    'Thermidor', 'Fructidor',
      'jour complémentaire',
    ]},
  );
decade_days

Default for this attribute should be a sorted array reference of 10 strings, each of them translating the name of each day ('Primidi', 'Duodi', 'Tridi', 'Quartidi', 'Quintidi', 'Sextidi', 'Septidi', 'Octidi', 'Nonidi', and 'Décadi' in French). E.g.:

  has '+decade_days' => (
    default => sub {[
      'Primidi',
      'Duodi',
      'Tridi',
      'Quartidi',
      'Quintidi',
      'Sextidi',
      'Septidi',
      'Octidi',
      'Nonidi',
      'Décadi',
    ]},
  );
feast

Default for this attribute should be a sorted array reference of 366 strings, each of them translating the feast of each day. Any space in the name of the feast of the day should be replaced by an underscore (_).

The feast of the day is used in sentences like this is feast name day or c'est le jour de la feast name. Depending on the language, it could then be prefixed or suffixed: in English it is suffixed by day, whereas in French it is prefixed by jour de la . See "prefixes" and "suffix" attributes below.

Moreover, in languages where the feast of the day is prefixed, the prefix often depends on the gender or the number of the noun used for the feast, or whereas this noun starts by a vowel. Therefore, "prefixes" attribute should be an array of each possible prefix, and each translation of the feast of each day should starts with a digit specifying the index (starting from 0) in the prefixes attribute to use for this word. E.g.: with prefixes defaulting to ['jour du ', 'jour de la ', "jour de l'", 'jour des '], some default values for feast attribute include '1carotte', '2amaranthe', '0panais' (because you say: jour de la carotte, with prefix number 1, jour de l'amaranthe, with prefix number 2, and jour du panais, with prefix number 0. If the language does not use any prefix before the feast of the day, each translation for the feast of the day should start with 0.

prefixes

Default for this attribute should be a sorted array reference of possible prefixes, as strings, to use with the feast of the day, see "feast" attribute below. E.g.:

  has '+prefixes' => (
    default => sub {[
      'jour du ',
      'jour de la ',
      "jour de l'",
      'jour des ',
    ]},
  );

If the language does not use any prefix before the feast of the day, you should not overload this attribute with a default.

suffix

Default for this attribute should be a string specifying the suffix to use with the feast of the day, see "feast" attribute below. E.g.:

  has '+suffix' => (
    default => ' day',
  );

If the language does not use a suffix after the feast of the day, you should not overload this attribute with a default.

wikipedia_entries

Default for this attribute should be a hash reference, keyed by numbers of months (starting from 1), valued by an inner hash reference defining the localized wikipedia entry corresponding to each localized feast of the day. This is useful when the feast of the day corresponds to an ambiguous entry, or a different word, in wikipedia. If the wikipedia entry is the same as the feast of the day, you can omit it in the default hashref for wikipedia_entries attribute. E.g.:

  has '+wikipedia_entries' => (
    default => sub {{
      2 => {
        'water chestnut' => 'Water_caltrop',
      },
      8 => {
        'hoe'            => 'Hoe_(tool)',
      },
    }},
  );

METHODS

month_name

Returns the name of the month. Takes a DateTime::Calendar::FrenchRevolutionary object as mandatory parameter.

day_name

Returns the name of the day. Takes a DateTime::Calendar::FrenchRevolutionary object as mandatory parameter.

feast_short

Returns the feast of the day. Takes a DateTime::Calendar::FrenchRevolutionary object as mandatory parameter.

feast_long

Returns the feast of the day in long format (day of <xxx>). Takes a DateTime::Calendar::FrenchRevolutionary object as mandatory parameter.

wikipedia_redirect

Returns the wikipedia entry (the end of the wikipedia url) corresponding to the feast of the day. Takes two mandatory parameters: the month as integer from 1 to 13 (13 is used for complementary days, also called "sans-culottides"), and the search entry (which should be the feast of the day as returned by "feast_short") as a string.

SEE ALSO

spread-revolutionary-date
App::SpreadRevolutionaryDate
App::SpreadRevolutionaryDate::Config
App::SpreadRevolutionaryDate::Target
App::SpreadRevolutionaryDate::Target::Twitter
App::SpreadRevolutionaryDate::Target::Mastodon
App::SpreadRevolutionaryDate::Target::Freenode
App::SpreadRevolutionaryDate::Target::Freenode::Bot
App::SpreadRevolutionaryDate::MsgMaker
App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate
App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Calendar
App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Locale::fr
App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Locale::en
App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Locale::it
App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Locale::es
App::SpreadRevolutionaryDate::MsgMaker::PromptUser

AUTHOR

Gérald Sédrati-Dinet <gibus@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2019 by Gérald Sédrati-Dinet.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007