File Coverage

blib/lib/SpeL/I18n.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             # -*- cperl -*-
2             # ABSTRACT: Base class for localizations
3              
4              
5 41     41   273 use strict;
  41         78  
  41         1465  
6 41     41   204 use warnings;
  41         69  
  41         2242  
7             package SpeL::I18n;
8              
9 41     41   209 use parent 'Locale::Maketext';
  41         70  
  41         936  
10              
11             our %Lexicon =
12             (
13             '_AUTO' => 1,
14             'title' => 'title',
15             'author' => 'author',
16             'page' => 'page',
17             'part' => 'part',
18             'chapter' => 'chapter',
19             'appendix' => 'appendix',
20             'section' => 'section',
21             'subsection' => 'subsection',
22             'subsubsection' => 'subsection',
23             'subsubsubsection' => 'subsection',
24             'footnote' => 'footnote',
25             'figure' => 'figure',
26             'table' => 'table',
27             'equation' => 'equation',
28             'exercise' => 'exercise',
29             'listing' => 'listing',
30             'dotdotdot' => 'and so on until',
31             'pi' => 'pie',
32             'infty' => 'infinity',
33             '+' => 'plus',
34             '-' => 'minus',
35             'plusminus' => 'plus or minus',
36             '%' => 'percent',
37             '*' => 'times',
38             '=' => ',equals,',
39             'approx' => ',approximately equals,',
40             'notequal' => ',not equal to,',
41             'equivalent' => 'is equivalent with',
42             '<' => 'is smaller than',
43             '<<' => 'is much smaller than',
44             '>' => 'is greater than',
45             '>>' => 'is much greater than',
46             '<=' => 'is smaller than or equal to',
47             '>=' => 'is greater than or equal to',
48             '==>' => ',resulting in',
49             '<==' => ',and this results from',
50             '<=>' => ',and this is equivalent with',
51             'log' => 'the logarithm',
52             'logn' => 'the base [_1] logarithm',
53             'ln' => 'the natural logarithm',
54             'sin' => 'sine' ,
55             'cos' => 'cosine',
56             'tan' => 'tangent',
57             'cot' => 'cotangent',
58             'sec' => 'secant',
59             'csc' => 'cosecant',
60             'arcsin' => 'arcsine',
61             'arccos' => 'arccosine',
62             'arctan' => 'arctangent',
63             'arccot' => 'arccotangent',
64             'sinh' => 'hyperbolic sine',
65             'cosh' => 'hyperbolic cosine',
66             'tanh' => 'hyperbolic tangent',
67             'coth' => 'hyperbolic cotangent',
68             'alpha' => 'α',
69             'beta' => 'β',
70             'gamma' => 'γ',
71             'delta' => 'δ',
72             'epsilon' => 'ε',
73             'zeta' => 'ζ',
74             'eta' => 'η',
75             'theta' => 'θ',
76             'iota' => 'ι',
77             'kappa' => 'κ',
78             'lambda' => 'λ',
79             'mu' => 'μ',
80             'nu' => 'ν',
81             'xi' => 'ξ',
82             'omicron' => 'ο',
83             'pi' => 'π',
84             'rho' => 'ρ',
85             'sigma' => 'σ',
86             'tau' => 'τ',
87             'upsilon' => 'υ',
88             'phi' => 'φ',
89             'chi' => 'χ',
90             'psi' => 'ψ',
91             'omega' => 'ω',
92             'And' => 'and',
93             'Function' => '[_1] of [_2]',
94             'Int' => 'the integral',
95             'Limit' => 'the limit',
96             'Max' => 'the maximum',
97             'Min' => 'the minimum',
98             'Limitsexpression' => sub {
99             my $lh = $_[0];
100             $_[1] = $lh->maketext( $_[1] );
101             # with ubound
102             defined( $_[3] ) and do {
103             return "$_[1] from $_[2] to $_[3], of:";
104             };
105             return "$_[1] for $_[2], of:";
106             },
107             'Overbrace' => '[_1]',
108             'Underbrace' => '[_1]',
109             'matrix' => 'a matrix with elements',
110             'bmatrix' => 'a matrix with elements',
111             'pmatrix' => 'a matrix with elements',
112             'smallmatrix' => 'a matrix with elements',
113             'vmatrix' => 'the determinant of a matrix with elements',
114             'Vmatrix' => 'the norm of a matrix with elements',
115             'Mid' => 'for which:',
116             'Overline' => sub {
117             my $lh = $_[0];
118             return $_[1] . ' bar';
119             },
120             'Intpower' => 'to the power of',
121             'Faculty' => 'faculty',
122             'Power' => sub {
123             my $lh = $_[0];
124             ( $_[1] eq '1' ) and do { return '' };
125             ( $_[1] eq '2' ) and do { return ' square' };
126             ( $_[1] eq '3' ) and do { return ' cube' };
127             return ' to the power of ' . $_[1];
128             },
129             'Transposed' => 'transposed',
130             'Cancels' => 'which cancels',
131             'Sum' => 'the summation',
132             'Squareroot' => sub {
133             my $lh = $_[0];
134             ( $_[1] eq '2' ) and do { return "the square root of $_[2]"; };
135             ( $_[1] eq '3' ) and do { return "the 3rd root of $_[2]"; };
136             return "the $_[1]th root of $_[2]";
137             },
138             'Div' => '[_1], over [_2]',
139             'In' => ' element of ',
140             'Leadsto' => ' is associated with ',
141             'To' => ' going to ',
142             'Absval' => sub {
143             # my $lh = $_[0];
144             return ' the absolute value of ' . $_[1];
145             },
146             'Norm' => sub {
147             return ' the norm of ' . $_[1];
148             },
149             'Subjectto' => sub {
150             return $_[1] . " subject to ";
151             },
152             'Re' => sub {
153             # my $lh = $_[0];
154             return ' Re ' . $_[1];
155             },
156             'Im' => sub {
157             # my $lh = $_[0];
158             return ' Im ' . $_[1];
159             },
160             'Interval' => sub {
161             # my $lh = $_[0];
162             return "the closed interval from $_[2] to $_[3]"
163             if ( $_[1] eq 'cc' );
164             return "the open interval from $_[2] to $_[3]"
165             if ( $_[1] eq 'oo' );
166             return "the half open interval from $_[2] (not included) to $_[3]"
167             if ( $_[1] eq 'oc' );
168             return "the half open interval from $_[2] to $_[3] (not included)"
169             if ( $_[1] eq 'co' );
170             return 'Error: wrong interval';
171             },
172             'Setenum' => 'a set consisting of [_1]',
173             'Setdesc' => 'a set containing elements [_1]',
174             'Arg' => 'arg [_1]',
175             'Unitof' => 'the unit of [_1]',
176             'Sim' => 'is proportional to',
177             );
178              
179             our $lh;
180              
181              
182             1;
183              
184             __END__