X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Flib%2FRT%2FI18N%2Fcs.pm;fp=rt%2Flib%2FRT%2FI18N%2Fcs.pm;h=36e2bc6af8eb27edc0cfd94f44879eecb436167f;hb=945721f48f74d5cfffef7c7cf3a3d6bc2521f5dd;hp=0000000000000000000000000000000000000000;hpb=160be29a0dc62e79a4fb95d2ab8c0c7e5996760e;p=freeside.git diff --git a/rt/lib/RT/I18N/cs.pm b/rt/lib/RT/I18N/cs.pm new file mode 100644 index 000000000..36e2bc6af --- /dev/null +++ b/rt/lib/RT/I18N/cs.pm @@ -0,0 +1,68 @@ +package RT::I18N::cs; + +# # CZECH TRANSLATORS COMMENTS see Locale::Maketext::TPJ13 +# Obecne parametry musi byt docela slozite (v pripade Slavistickych jazyku) +# typu pocet, slovo, pad a rod +# +#pad 1., rod muzsky: +#0 krecku +#1 krecek +#2..4 krecci +#5.. krecku (nehodi se zde resit pravidlo mod 1,2,3,4 krom mod 11,12,13,14) +# +#0 kabatu +#1 kabat +#2..4 kabaty +#5 kabatu +# +# => Vyplati se udelat quant s parametry typu pocet, slovo1, slovo2..4, slovo5 a slovo0 +# + +sub quant { + my($handle, $num, @forms) = @_; + + return $num if @forms == 0; # what should this mean? + return $forms[3] if @forms > 3 and $num == 0; # special zeroth case + + # Normal case: + # Note that the formatting of $num is preserved. + #return( $handle->numf($num) . ' ' . $handle->numerate($num, @forms) ); + return( $handle->numerate($num, @forms) ); + # Most human languages put the number phrase before the qualified phrase. +} + + +sub numerate { + # return this lexical item in a form appropriate to this number + my($handle, $num, @forms) = @_; + my $s = ($num == 1); + + return '' unless @forms; + return + $s ? $forms[0] : + ( $num > 1 && $num < 5 ) ? $forms[1] : + $forms[2]; +} + +#-------------------------------------------------------------------------- + +sub numf { + my($handle, $num) = @_[0,1]; + if($num < 10_000_000_000 and $num > -10_000_000_000 and $num == int($num)) { + $num += 0; # Just use normal integer stringification. + # Specifically, don't let %G turn ten million into 1E+007 + } else { + $num = CORE::sprintf("%G", $num); + # "CORE::" is there to avoid confusion with the above sub sprintf. + } + while( $num =~ s/^([-+]?\d+)(\d{3})/$1,$2/s ) {1} # right from perlfaq5 + # The initial \d+ gobbles as many digits as it can, and then we + # backtrack so it un-eats the rightmost three, and then we + # insert the comma there. + + $num =~ tr<.,><,.> if ref($handle) and $handle->{'numf_comma'}; + # This is just a lame hack instead of using Number::Format + return $num; +} + +1;