diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-10-24 23:15:21 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-10-24 23:15:21 +0000 |
commit | 44a10f204619947939be3822034aa79c1ca2d689 (patch) | |
tree | f1805b2d226cd133a6610d46ba3c683d94be1dd5 /locale/it/Num2text | |
parent | e739b6a4447584ac142e0a644f707e95744c96b2 (diff) |
Converting Italian translation to gettext
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@294 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'locale/it/Num2text')
-rwxr-xr-x | locale/it/Num2text | 162 |
1 files changed, 0 insertions, 162 deletions
diff --git a/locale/it/Num2text b/locale/it/Num2text deleted file mode 100755 index a330a785..00000000 --- a/locale/it/Num2text +++ /dev/null @@ -1,162 +0,0 @@ -#===================================================================== -# LedgerSMB Small Medium Business Accounting -# Copyright (C) 2002 -# -# Original Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://sourceforge.net/projects/sql-ledger/ -# -# Contributors: Luca Venturini <luca@yepa.com> -# -# 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 => 'Zero', - 1 => 'uno', - 2 => 'due', - 3 => 'tre', - 4 => 'quattro', - 5 => 'cinque', - 6 => 'sei', - 7 => 'sette', - 8 => 'otto', - 9 => 'nove', - 10 => 'dieci', - 11 => 'undici', - 12 => 'dodici', - 13 => 'tredici', - 14 => 'quattrodici', - 15 => 'quindici', - 16 => 'sedici', - 17 => 'diciassette', - 18 => 'diciotto', - 19 => 'diciannove', - 20 => 'venti', - 30 => 'trenta', - 40 => 'quaranta', - 50 => 'cinquanta', - 60 => 'sessanta', - 70 => 'settanta', - 80 => 'ottanta', - 90 => 'novanta', - 10**2 => 'cento', - 10**3 => 'mille', - 10**6 => 'milione', - 10**9 => 'miliardo', - 10**12 => 'mille miliardi' - ); - -} - - -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; - } - - while (@numblock) { - - $i = $#numblock; - @num = split //, $numblock[$i]; - - $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; - } - - if ($numblock[$i] > 9) { - # tens - push @textnumber, $self->format_ten($numblock[$i]); - } elsif ($numblock[$i] > 1) { - # ones - push @textnumber, $self->{numbername}{$numblock[$i]}; - } - - # add thousand, million - if ($i) { - $amount = 10**($i * 3); - push @textnumber, $self->{numbername}{$amount}; - } - - pop @numblock; - - } - - join '', @textnumber; - -} - - -sub format_ten { - my ($self, $amount) = @_; - - my $textnumber = ""; - my @num = split //, $amount; - - if ($amount > 20) { - if ($num[1] == 0) { - $textnumber = $self->{numbername}{$amount}; - } else { - $amount = $num[0] * 10; - $textnumber = $self->{numbername}{$amount}.$self->{numbername}{$num[1]}; - } - } else { - $textnumber = $self->{numbername}{$amount}; - } - - $textnumber; - -} - - -1; - |