diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-10-24 19:23:34 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-10-24 19:23:34 +0000 |
commit | 9ca1b581aa9f6f25ecf31d58155016277855f161 (patch) | |
tree | ed9db2c5b55512a57138931bce51ae5cf0c2388c /locale/ru_utf/Num2text | |
parent | f25b72b68accb03652c7ac58e5c3184f14375d17 (diff) |
Convert Russian translation to gettext
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@292 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'locale/ru_utf/Num2text')
-rwxr-xr-x | locale/ru_utf/Num2text | 184 |
1 files changed, 0 insertions, 184 deletions
diff --git a/locale/ru_utf/Num2text b/locale/ru_utf/Num2text deleted file mode 100755 index 3dea227a..00000000 --- a/locale/ru_utf/Num2text +++ /dev/null @@ -1,184 +0,0 @@ -#===================================================================== -# LedgerSMB Small Medium Business Accounting -# Copyright (C) 2005 -# -# Author: Dieter Simader -# Web: http://www.ledgersmb.org/ -# -# Contributors: Vladimir Khaimin <vkhai@yandex.ru> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#====================================================================== -# -# this is a variation of the Lingua package -# written for check and receipt printing -# it returns a properly formatted text string -# for a number up to 10**12 - -sub init { - my $self = shift; - - %{ $self->{numbername} } = - (0 => 'ноль', - 1 => 'один', - 2 => 'два', - 3 => 'три', - 4 => 'четыре', - 5 => 'пять', - 6 => 'шесть', - 7 => 'семь', - 8 => 'восемь', - 9 => 'девять', - 10 => 'десять', - 11 => 'одинадцать', - 12 => 'двенадцать', - 13 => 'тринадцать', - 14 => 'четырнадцать', - 15 => 'пятнадцать', - 16 => 'шестнадцать', - 17 => 'семнадцать', - 18 => 'восемнадцать', - 19 => 'девятнадцать', - 20 => 'двадцать', - 30 => 'тридцать', - 40 => 'сорок', - 50 => 'пятьдесят', - 60 => 'шестьдесят', - 70 => 'семьдесят', - 80 => 'восемьдесят', - 90 => 'девяносто', - 10**2 => 'сто', - 10**3 => 'тысяча', - 10**6 => 'миллион', - 10**9 => 'миллиард', - 10**12 => 'триллион' - ); - -} - - -sub num2text { - my ($self, $amount) = @_; - - return $self->{numbername}{0} unless $amount; - - my @textnumber = (); - - # split amount into chunks of 3 - my @num = reverse split //, abs($amount); - my @numblock = (); - my ($i, $appendn); - my @a = (); - - while (@num) { - @a = (); - for (1 .. 3) { - push @a, shift @num; - } - push @numblock, join / /, reverse @a; - } - - my $belowhundred = !$#numblock; - - while (@numblock) { - - $i = $#numblock; - @num = split //, $numblock[$i]; - $appendn = ""; - - $numblock[$i] *= 1; - - if ($numblock[$i] == 0) { - pop @numblock; - next; - } - - if ($numblock[$i] > 99) { - # the one from hundreds - push @textnumber, $self->{numbername}{$num[0]}; - - # add hundred designation - push @textnumber, $self->{numbername}{10**2}; - - # reduce numblock - $numblock[$i] -= $num[0] * 100; - } - - $appendn = 'en' if ($i == 2); - $appendn = 'n' if ($i > 2); - - if ($numblock[$i] > 9) { - # tens - push @textnumber, $self->format_ten($numblock[$i], $belowhundred); - } elsif ($numblock[$i] > 1) { - # ones - push @textnumber, $self->{numbername}{$numblock[$i]}; - } elsif ($numblock[$i] == 1) { - if ($i == 0) { - push @textnumber, $self->{numbername}{$numblock[$i]}.'s'; - } else { - if ($i >= 2) { - push @textnumber, $self->{numbername}{$numblock[$i]}.'e'; - } else { - push @textnumber, $self->{numbername}{$numblock[$i]}; - } - } - $appendn = ""; - } - - # add thousand, million - if ($i) { - $amount = 10**($i * 3); - push @textnumber, $self->{numbername}{$amount}.$appendn; - } - - pop @numblock; - - } - - join '', @textnumber; - -} - - -sub format_ten { - my ($self, $amount, $belowhundred) = @_; - - my $textnumber = ""; - my @num = split //, $amount; - - if ($amount > 20) { - if ($num[1] == 0) { - $textnumber = $self->{numbername}{$amount}; - } else { - if ($belowhundred) { - $amount = $num[0] * 10; - $textnumber = $self->{numbername}{$num[1]}.'und'.$self->{numbername}{$amount}; - } else { - $amount = $num[0] * 10; - $textnumber = $self->{numbername}{$amount}.$self->{numbername}{$num[1]}; - $textnumber .= 's' if ($num[1] == 1); - } - } - } else { - $textnumber = $self->{numbername}{$amount}; - } - - $textnumber; - -} - - -1; - |