3 # Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 # (Except where explictly superceded by other copyright notices)
7 # This work is made available to you under the terms of Version 2 of
8 # the GNU General Public License. A copy of that license should have
9 # been provided with this software, but in any event can be snarfed
12 # This work is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # Unless otherwise specified, all modifications, corrections or
18 # extensions to this work which alter its source code become the
19 # property of Best Practical Solutions, LLC when submitted for
20 # inclusion in the work.
26 # # CZECH TRANSLATORS COMMENTS see Locale::Maketext::TPJ13
27 # Obecne parametry musi byt docela slozite (v pripade Slavistickych jazyku)
28 # typu pocet, slovo, pad a rod
34 #5.. krecku (nehodi se zde resit pravidlo mod 1,2,3,4 krom mod 11,12,13,14)
41 # => Vyplati se udelat quant s parametry typu pocet, slovo1, slovo2..4, slovo5 a slovo0
45 my($handle, $num, @forms) = @_;
47 return $num if @forms == 0; # what should this mean?
48 return $forms[3] if @forms > 3 and $num == 0; # special zeroth case
51 # Note that the formatting of $num is preserved.
52 #return( $handle->numf($num) . ' ' . $handle->numerate($num, @forms) );
53 return( $handle->numerate($num, @forms) );
54 # Most human languages put the number phrase before the qualified phrase.
59 # return this lexical item in a form appropriate to this number
60 my($handle, $num, @forms) = @_;
63 return '' unless @forms;
66 ( $num > 1 && $num < 5 ) ? $forms[1] :
70 #--------------------------------------------------------------------------
73 my($handle, $num) = @_[0,1];
74 if($num < 10_000_000_000 and $num > -10_000_000_000 and $num == int($num)) {
75 $num += 0; # Just use normal integer stringification.
76 # Specifically, don't let %G turn ten million into 1E+007
78 $num = CORE::sprintf("%G", $num);
79 # "CORE::" is there to avoid confusion with the above sub sprintf.
81 while( $num =~ s/^([-+]?\d+)(\d{3})/$1,$2/s ) {1} # right from perlfaq5
82 # The initial \d+ gobbles as many digits as it can, and then we
83 # backtrack so it un-eats the rightmost three, and then we
84 # insert the comma there.
86 $num =~ tr<.,><,.> if ref($handle) and $handle->{'numf_comma'};
87 # This is just a lame hack instead of using Number::Format