FrenchRevolutionary/Locale/es.pm

filter: Statementstmt 95.3% 82 / 86 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.4% 38 / 42 Podpod 91.6% 33 / 36 totaltotal 93.4% 157 / 168 CC 3 SCAR 1.7
CC
3
Cov
96%
am_pm
2.0
_datetime_format_pattern_order
2.0
month_names
2.0
CRAP 1.2
« FrenchRevolutionary/Locale/fr.pm ↑ Summary FrenchRevolutionary/Locale/it.pm »
1 # -*- encoding: utf-8; indent-tabs-mode: nil -*-
2 #
3 # Perl DateTime extension for providing Spanish strings for the French Revolutionary calendar
4 # Copyright (c) 2021 Jean Forget. All rights reserved.
5 #
6 # See the license in the embedded documentation below.
7 #
8  
9 package DateTime::Calendar::FrenchRevolutionary::Locale::es;
10  
11 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 3 $VERSION = '0.17'; # same as parent module DT::C::FR
17  
18 3 my @months_short = qw (Vnd Bru Fri Niv Plu Vnt Ger Flo Pra Mes Ter Fru D-C);
19  
20 # based on Gibus' App::SpreadRevolutionaryDate, itself
21 # based on Wikipedia: L<https://es.wikipedia.org/wiki/Calendario_republicano_franc%C3%A9s>.
22 3 my @months = qw(Vendimiario Brumario Frimario
23 Nivoso Pluvioso Ventoso
24 Germinal Floreal Pradial
25 Mesidor Termidor Fructidor
26 );
27  
28 3 push @months, 'día complementario';
29  
30 3 my @decade_days = qw (Primidi Duodi Tridi Quartidi Quintidi Sextidi Septidi Octidi Nonidi Décadi);
31 3 my @decade_days_short = qw (Pri Duo Tri Qua Qui Sex Sep Oct Non Déc);
32  
33 3 my @am_pms = qw(AM PM);
34  
35 3 my $date_before_time = "1";
36 3 my $default_date_format_length = "medium";
37 3 my $default_time_format_length = "medium";
38 3 my $date_parts_order = "dmy";
39  
40 3 my %date_formats = (
41 "short" => "\%d\/\%m\/\%Y",
42 "medium" => "\%a\ \%d\ \%b\ \%Y",
43 "long" => "\%A\ \%d\ \%B\ \%EY",
44 "full" => "\%A\ \%d\ \%B\ \%EY\,\ \%{feast_long\}",
45 );
46  
47 3 my %time_formats = (
48 "short" => "\%H\:\%M",
49 "medium" => "\%H\:\%M\:\%S",
50 "long" => "\%H\:\%M\:\%S",
51 "full" => "\%H\ h\ \%M\ mn \%S\ s",
52 );
53  
54 # When initializing an array with lists within lists, it means one of two things:
55 # Either it is a newbie who does not know how to make multi-dimensional arrays,
56 # Or it is a (at least mildly) experienced Perl-coder who, for some reason,
57 # wants to initialize a flat array with the concatenation of lists.
58 # I am a (at least mildly) experienced programmer who wants to use qw() and yet insert
59 # comments in some places.
60 # This array is mainly based on Gibus' App::SpreadRevolutionaryDate, itself
61 # based on Wikipedia: L<https://es.wikipedia.org/wiki/Calendario_republicano_franc%C3%A9s>.
62 3 my @feast = (
63 # Vendémiaire
64 qw(
65 1uva 0azafrán 1castaña 1cólquida 0caballo
66 1balsamina 1zanahoria 0amaranto 1chirivía 1tinaja
67 1patata 1flor_de_papel 1calabaza 1reseda 0asno
68 1bella_de_noche 1calabaza_otoñal 0alforfón 0girasol 0lagar
69 0cáñamo 0melocotón 0nabo 1amarilis 0buey
70 1berenjena 0pimiento 0tomate 1cebada 0barril
71 ),
72 # Brumaire
73 qw(
74 1manzana 0apio 1pera 1remolacha 1oca
75 0heliótropo 0higo 1escorzonera 0mostajo 0arado
76 1salsifí 1castaña_de_agua 0tupinambo 1endibia 0guajolote
77 1escaravía 0berro 1dentelaria 1granada 1grada
78 1bacante 0acerolo 1rubia_roja 1naranja 0faisán
79 0pistacho 0lathyrus_tuberosus 0membrillo 0serbal 0rodillo
80 ),
81 # Frimaire
82 qw(
83 0rapónchigo 0nabo_forrajero 1achicoria 0níspero 0cerdo
84 0canónigo 1coliflor 1miel 0enebro 0pico
85 1cera 0rábano_picante 0cedro 0abeto 0corzo
86 0tojo 1ciprés 1hiedra 1sabina 0azadón
87 0arce 0brezo 1caña 1acedera 0grillo
88 1piñón 0corcho 1trufa 1aceituna 1pala
89 ),
90 # Nivôse
91 qw(
92 1turba 0carbón 0betún 0azufre 1perro
93 1lava 0suelo 1estiércol 0salitre 0mayal
94 0granito 1arcilla 1pizarra 1arenisca 0conejo
95 1sílex 1marga 1caliza 0mármol 1aventadora_de_cereal
96 1piedra_de_yeso 1sal 0hierro 0cobre 1gato
97 0estaño 0plomo 0cinc 0mercurio 0tamiz
98 ),
99 # Pluviôse
100 qw(
101 1laureola 0musgo 0rusco 0galanto 0toro
102 0laurentino 0hongo_yesquero 0mezereón 0álamo 0hacha
103 0eléboro 1brécol 0laurel 0avellano 1vaca
104 0boj 0liquen 0tejo 1pulmonaria 1navaja_podadora
105 0carraspique 0torvisco 1gramilla 1centinodia 1liebre
106 1isatide 0avellano 0ciclamen 1celidonia_mayor 0trineo
107 ),
108 # Ventôse
109 qw(
110 0tusilago 0corno 0alhelí 0aligustre 0macho_cabrío
111 0jengibre_silvestre 0aladierno 0violeta 1sauce_cabruno 1laya
112 0narciso 0olmo 1fumaria 0erísimo 1cabra
113 1espinaca 0doronicum 1anagallis 0perifollo 0hilo
114 1mandrágora 0perejil 1coclearia 1margarita 0atún
115 0diente_de_león 1anémona_de_bosque 0culantrillo 0fresno 0plantador
116 ),
117 # Germinal
118 qw(
119 1primavera 0sicomoro 0espárrago 0tulipán 1gallina
120 1acelga 0abedul 0junquillo 0alnus 0nidal
121 1vincapervinca 0carpe 1morchella 0haya 1abeja
122 1lechuga 0alerce 1cicuta 0rábano 1colmena
123 1árbol_de_Judea 1lechuga_romana 0castaño_de_Indias 1roqueta 1paloma
124 0lila 1anémona 0pensamiento 0arándano 0cuchillo
125 ),
126 # Floréal
127 qw(
128 0rosa 0roble 0helecho 0espino_albar 0ruiseñor
129 1aguileña 1convalaria 1seta 0jacinto 0rastrillo
130 0ruibarbo 1esparceta 0erysimum 0palmito 0gusano_de_seda
131 1consuelda 1algáfita 0alyssum 0atriplex 0escardillo
132 0limonium_sinuatum 1fritillaria 1borraja 1valeriana 1carpa
133 0bonetero 0cebollino 1anchusa 1mostaza_negra 0armuelle
134 ),
135 # Prairial
136 qw(
137 1alfalfa 0lirio_de_día 0trébol 1angélica 0pato
138 0toronjil 1mazorra 0martagón 0serpol 1guadaña
139 1fresa 1salvia 0guisante 1acacia 1codorniz
140 0clavel 0saúco 1adormidera 0tilo 0bieldo
141 0barbo 1manzanilla 1madreselva 0galium 1tenca
142 0jazmín 1verbena 0tomillo 1peonía 0carro
143 ),
144 # Messidor
145 qw(
146 0centeno 1avena 1cebolla 1veronica 1mula
147 1romero 0pepino 0chalote 1absenta 1hoz
148 0cilantro 1alcachofa 0alhelí 1lavanda 1gamuza
149 0tabaco 1grosella 0lathyrus 1cereza 0parque
150 1menta 0comino 1judía 1palomilla_de_tintes 1gallina_de_Guinea
151 1salvia 0ajo 1algarroba 0trigo 1chirimía
152 ),
153 # Thermidor
154 qw(
155 1escanda 0verbasco 0melón 1cizaña 0carnero
156 1cola_de_caballo 1artemisa 0cártamo 1mora 1regadera
157 0panicum 0salicor 0albaricoque 1albahaca 1oveja
158 1malvaceae 0lino 1almendra 1genciana 1esclusa
159 1carlina 1alcaparra 1lenteja 1inula 1nutria
160 0mirto 1colza 0lupino 0algodón 0molino
161 ),
162 # Fructidor
163 qw(
164 1ciruela 0mijo 0soplo_de_lobo 1cebada_de_otoño 0salmón
165 0nardo 1cebada_de_invierno 1apocynaceae 0regaliz 1escala
166 1sandía 0hinojo 0berberis 1nuez 1trucha
167 0limón 1cardencha 0espino_cerval 0clavelón 0cesto
168 0escaramujo 1avellana 1lúpulo 0sorgo 0cangrejo_de_río
169 1naranja_amarga 1vara_de_oro 1maíz 1castaña 1cesta
170 ),
171 # Jours complémentaires
172 qw(
173 1virtud 0talento 0trabajo 1opinión 3recompensas
174 1revolución
175 ));
176 3 my @prefix = ( 'día del ', 'día de la ', 'día de los ', 'día de las ');
177  
178 3 my %event = ();
179  
180 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
181 9 return bless {}, $_[0];
182 }
183  
184 6 ▶sub month_name {
Subroutine month_name: called CC=1 SCAR=0.0
Pod documented
185 6 my ($self, $date) = @_;
186 6 return $months[$date->month_0]
187 }
188  
189 3 ▶sub month_abbreviation {
Subroutine month_abbreviation: called CC=1 SCAR=0.0
Pod documented
190 3 my ($self, $date) = @_;
191 3 return $months_short[$date->month_0]
192 }
193  
194 8 ▶sub day_name {
Subroutine day_name: called CC=1 SCAR=0.0
Pod documented
195 8 my ($self, $date) = @_;
196 8 return $decade_days[$date->day_of_decade_0];
197 }
198  
199 5 ▶sub day_abbreviation {
Subroutine day_abbreviation: called CC=1 SCAR=0.0
Pod documented
200 5 my ($self, $date) = @_;
201 5 return $decade_days_short[$date->day_of_decade_0];
202 }
203  
204 4 ▶sub am_pm { $_[0]->am_pms->[ $_[1]->hour < 5 ? 0 : 1 ] }
Subroutine am_pm: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->hour < 5 ? : 1 3 4
205  
206 1 ▶sub _raw_feast {
Subroutine _raw_feast: called CC=1 SCAR=0.0
207 1 my ($self, $date) = @_;
208 1 $feast[$date->day_of_year_0];
209 }
210  
211 1 ▶sub feast_short {
Subroutine feast_short: called CC=1 SCAR=0.0
Pod documented
212 1 my ($self, $date) = @_;
213 1 my $lb = $feast[$date->day_of_year_0];
214 1 $lb =~ s/^\?//;
215 1 $lb =~ s/_/ /g;
216 1 return substr($lb, 1);
217 }
218  
219 1 ▶sub feast_long {
Subroutine feast_long: called CC=1 SCAR=0.0
Pod documented
220 1 my ($self, $date) = @_;
221 1 my $lb = $feast[$date->day_of_year_0];
222 1 $lb =~ s/^\?//;
223 1 $lb =~ s/_/ /g;
224 1 $lb =~ s/^(\d)/$prefix[$1]/;
225 1 return $lb;
226 }
227  
228 4 ▶sub feast_caps {
Subroutine feast_caps: called CC=1 SCAR=0.0
Pod documented
229 4 my ($self, $date) = @_;
230 4 my $lb = $feast[$date->day_of_year_0];
231 4 $lb =~ s/^\?//;
232 4 $lb =~ s/_/ /g;
233 4 $lb =~ s/^(\d)(.)/\u$prefix[$1]\u$2/;
234 4 return $lb;
235 }
236  
237 4 ▶sub full_date_format { $_[0]->date_formats->{full} }
Subroutine full_date_format: called CC=1 SCAR=0.0
Pod documented
238 4 ▶sub long_date_format { $_[0]->date_formats->{long} }
Subroutine long_date_format: called CC=1 SCAR=0.0
Pod documented
239 4 ▶sub medium_date_format { $_[0]->date_formats->{medium} }
Subroutine medium_date_format: called CC=1 SCAR=0.0
Pod documented
240 4 ▶sub short_date_format { $_[0]->date_formats->{short} }
Subroutine short_date_format: called CC=1 SCAR=0.0
Pod documented
241 4 ▶sub default_date_format { $_[0]->date_formats->{ $_[0]->default_date_format_length } }
Subroutine default_date_format: called CC=1 SCAR=0.0
Pod documented
242  
243 4 ▶sub full_time_format { $_[0]->time_formats->{full} }
Subroutine full_time_format: called CC=1 SCAR=0.0
Pod documented
244 4 ▶sub long_time_format { $_[0]->time_formats->{long} }
Subroutine long_time_format: called CC=1 SCAR=0.0
Pod documented
245 4 ▶sub medium_time_format { $_[0]->time_formats->{medium} }
Subroutine medium_time_format: called CC=1 SCAR=0.0
Pod documented
246 4 ▶sub short_time_format { $_[0]->time_formats->{short} }
Subroutine short_time_format: called CC=1 SCAR=0.0
Pod documented
247 4 ▶sub default_time_format { $_[0]->time_formats->{ $_[0]->default_time_format_length } }
Subroutine default_time_format: called CC=1 SCAR=0.0
Pod documented
248  
249 10 ▶sub _datetime_format_pattern_order { $_[0]->date_before_time ? (0, 1) : (1, 0) }
Subroutine _datetime_format_pattern_order: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->date_before_time ? : 5 5 10
250  
251 2 ▶sub full_datetime_format { join ' ', ( $_[0]-> full_date_format, $_[0]-> full_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine full_datetime_format: called CC=1 SCAR=0.0
Pod documented
252 2 ▶sub long_datetime_format { join ' ', ( $_[0]-> long_date_format, $_[0]-> long_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine long_datetime_format: called CC=1 SCAR=0.0
Pod documented
253 2 ▶sub medium_datetime_format { join ' ', ( $_[0]-> medium_date_format, $_[0]-> medium_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine medium_datetime_format: called CC=1 SCAR=0.0
Pod documented
254 2 ▶sub short_datetime_format { join ' ', ( $_[0]-> short_date_format, $_[0]-> short_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine short_datetime_format: called CC=1 SCAR=0.0
Pod documented
255 2 ▶sub default_datetime_format { join ' ', ( $_[0]->default_date_format, $_[0]->default_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine default_datetime_format: called CC=1 SCAR=0.0
Pod documented
256  
257 4 ▶sub default_date_format_length { $default_date_format_length }
Subroutine default_date_format_length: called CC=1 SCAR=0.0
Pod documented
258 4 ▶sub default_time_format_length { $default_time_format_length }
Subroutine default_time_format_length: called CC=1 SCAR=0.0
Pod documented
259  
260 0 ▶sub month_names { [ @months ] }
Subroutine month_names: not called CC=1 SCAR=6.9
Pod documented
261 0 ▶sub month_abbreviations { [ @months_short ] }
Subroutine month_abbreviations: not called CC=1 SCAR=6.9
Pod documented
262 0 ▶sub day_names { [ @decade_days ] }
Subroutine day_names: not called CC=1 SCAR=6.9
Pod documented
263 0 ▶sub day_abbreviations { [ @decade_days_short ] }
Subroutine day_abbreviations: not called CC=1 SCAR=6.9
Pod documented
264 4 ▶sub am_pms { [ @am_pms ] }
Subroutine am_pms: called CC=1 SCAR=0.0
Pod undocumented
265 20 ▶sub date_formats { \%date_formats }
Subroutine date_formats: called CC=1 SCAR=0.0
Pod documented
266 20 ▶sub time_formats { \%time_formats }
Subroutine time_formats: called CC=1 SCAR=0.0
Pod documented
267 5 ▶sub date_before_time { $date_before_time }
Subroutine date_before_time: called CC=1 SCAR=0.0
Pod undocumented
268 2 ▶sub date_parts_order { $date_parts_order }
Subroutine date_parts_order: called CC=1 SCAR=0.0
Pod undocumented
269  
270 1 ▶sub on_date {
Subroutine on_date: called CC=1 SCAR=0.0
Pod documented
271 1 return '';
272 }
273  
274 # A module must return a true value. Traditionally, a module returns 1.
275 # But this module is a revolutionary one, so it discards all old traditions.
276 3 "Ah ! ça ira ! ça ira !";
277  
278 __END__
« FrenchRevolutionary/Locale/fr.pm ↑ Summary FrenchRevolutionary/Locale/it.pm »