[suspicious - maybe spam] cvs: pear /Numbers_Words ChangeLog README package.xml /Numbers_Words/Words lang.cs.php lang.en_US.php lang.es_AR.php
lang.he.php lang.hu_HU.php lang.pl.php
| From: | Piotr Klaban | Date: | Mon, 28 Feb 2005 13:22:52 +0000 |
| Subject: | [suspicious - maybe spam] cvs: pear /Numbers_Words ChangeLog README package.xml /Numbers_Words/Words lang.cs.php lang.en_US.php lang.es_AR.php lang.he.php lang.hu_HU.php lang.pl.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-29926@lists.php.net to get a copy of this message | ||
makler Mon Feb 28 08:22:52 2005 EDT
Added files:
/pear/Numbers_Words/Words lang.cs.php lang.he.php
Modified files:
/pear/Numbers_Words ChangeLog README package.xml
/pear/Numbers_Words/Words lang.en_US.php lang.es_AR.php
lang.hu_HU.php lang.pl.php
Log:
New languages: Czech and Hebrew. New currency ILS (Israeli Sheqel). Release 0.13.0
http://cvs.php.net/diff.php/pear/Numbers_Words/ChangeLog?r1=1.6&r2=1.7&ty=u Index: pear/Numbers_Words/ChangeLog diff -u pear/Numbers_Words/ChangeLog:1.6 pear/Numbers_Words/ChangeLog:1.7 --- pear/Numbers_Words/ChangeLog:1.6 Tue Jan 11 09:30:33 2005 +++ pear/Numbers_Words/ChangeLog Mon Feb 28 08:22:50 2005 @@ -1,3 +1,13 @@ +2005-02-28 + * Numbers_Words: Version 0.13.0 released. + * support for a new currency ILS (or NIS) for New Israeli Sheqel + +2005-02-15 + * Words/lang.cs.php: New language file: cs for Czech (Thanks to Petr 'PePa' Pavel) + +2005-02-03 + * Words/lang.he.php: New language file: he for Hebrew (Thanks to Hadar Porat) + 2005-01-11 * Numbers_Words: Version 0.12.0 released. * Words/lang.fr_BE.php: New language file: fr_BE for French (Belgium) (Thanks to Philippe Bajoit). http://cvs.php.net/diff.php/pear/Numbers_Words/README?r1=1.6&r2=1.7&ty=u Index: pear/Numbers_Words/README diff -u pear/Numbers_Words/README:1.6 pear/Numbers_Words/README:1.7 --- pear/Numbers_Words/README:1.6 Tue Jan 11 09:30:33 2005 +++ pear/Numbers_Words/README Mon Feb 28 08:22:50 2005 @@ -65,6 +65,9 @@ bg - Bulgarian language (in WIN-1251 charset). Author: Kouber Saparev + cs - Czech language. + Author: Petr 'PePa' Pavel + de - German language. Author: Piotr Klaban @@ -100,6 +103,9 @@ fr_BE - French (Belgium) language. Author: Kouber Saparev, Philippe Bajoit + he - Hebrew language. + Author: Hadar Porat + hu_HU - Hungarian language. Author: Nils Homp http://cvs.php.net/diff.php/pear/Numbers_Words/package.xml?r1=1.8&r2=1.9&ty=u Index: pear/Numbers_Words/package.xml diff -u pear/Numbers_Words/package.xml:1.8 pear/Numbers_Words/package.xml:1.9 --- pear/Numbers_Words/package.xml:1.8 Tue Jan 11 09:50:13 2005 +++ pear/Numbers_Words/package.xml Mon Feb 28 08:22:50 2005 @@ -13,21 +13,23 @@ The following languages are supported: * bg (Bulgarian) by Kouber Saparev - * de (German) + * cs (Czech) by Petr 'PePa' Pavel + * de (German) by me * dk (Danish) by Jesper Veggerby * ee (Estonian) by Erkki Saarniit - * en_100 (Donald Knuth system, English) - * en_GB (British English) - * en_US (American English) + * en_100 (Donald Knuth system, English) by me + * en_GB (British English) by me + * en_US (American English) by me * es (Spanish Castellano) by Xavier Noguer * es_AR (Argentinian Spanish) by Martin Marrese * fr (French) by Kouber Saparev * fr_BE (French Belgium) by Kouber Saparev and Philippe Bajoit + * he (Hebrew) by Hadar Porat * hu_HU (Hungarian) by Nils Homp * id (Indonesian) by Ernas M. Jamil and Arif Rifai Dwiyanto * it_IT (Italian) by Filippo Beltramini and Davide Caironi * lt (Lithuanian) by Laurynas Butkus - * pl (Polish) + * pl (Polish) by me * pt_BR (Brazilian Portuguese) by Marcelo Subtil Marcal and Mario H.C.T. * ru (Russian) by Andrey Demenev * sv (Swedish) by Robin Ericsson @@ -41,14 +43,15 @@ </maintainer> </maintainers> <release> - <version>0.12.0</version> - <date>2005-01-11</date> + <version>0.13.0</version> + <date>2005-02-28</date> <license>PHP License</license> <state>beta</state> - <notes>New file for French (Belgium) language (Thanks to Philippe Bajoit).</notes> + <notes>New files for Czech (thanks to Petr 'PePa' Pavel) and Hebrew (thanks to Hadar Porat) languages.</notes> <filelist> <file role="php" baseinstalldir="Numbers" name="Words.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.bg.php"/> + <file role="php" baseinstalldir="Numbers" name="Words/lang.cs.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.de.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.dk.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.ee.php"/> @@ -59,6 +62,7 @@ <file role="php" baseinstalldir="Numbers" name="Words/lang.es_AR.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.fr.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.fr_BE.php"/> + <file role="php" baseinstalldir="Numbers" name="Words/lang.he.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.hu_HU.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.id.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.it_IT.php"/> @@ -77,6 +81,13 @@ </release> <changelog> <release> + <version>0.12.0</version> + <date>2005-01-11</date> + <license>PHP License</license> + <state>beta</state> + <notes>New file for French (Belgium) language (Thanks to Philippe Bajoit).</notes> + </release> + <release> <version>0.11.0</version> <date>2004-10-22</date> <license>PHP License</license> http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.en_US.php?r1=1.2&r2=1.3&ty=u Index: pear/Numbers_Words/Words/lang.en_US.php diff -u pear/Numbers_Words/Words/lang.en_US.php:1.2 pear/Numbers_Words/Words/lang.en_US.php:1.3 --- pear/Numbers_Words/Words/lang.en_US.php:1.2 Thu Sep 2 07:07:59 2004 +++ pear/Numbers_Words/Words/lang.en_US.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Authors: Piotr Klaban <makler@man.torun.pl> | // +----------------------------------------------------------------------+ // -// $Id: lang.en_US.php,v 1.2 2004/09/02 11:07:59 makler Exp $ +// $Id: lang.en_US.php,v 1.3 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in American English language. // @@ -244,6 +244,7 @@ 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), + 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic króna'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.es_AR.php?r1=1.1&r2=1.2&ty=u Index: pear/Numbers_Words/Words/lang.es_AR.php diff -u pear/Numbers_Words/Words/lang.es_AR.php:1.1 pear/Numbers_Words/Words/lang.es_AR.php:1.2 --- pear/Numbers_Words/Words/lang.es_AR.php:1.1 Thu Sep 2 07:07:59 2004 +++ pear/Numbers_Words/Words/lang.es_AR.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Authors: Martin Marrese <mmare@mecon.gov.ar> | // | Based On: lang_es.php - Xavier Noguer | // +----------------------------------------------------------------------+ -// $Id: lang.es_AR.php,v 1.1 2004/09/02 11:07:59 makler Exp $ +// $Id: lang.es_AR.php,v 1.2 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Argentinian Spanish // @@ -139,6 +139,7 @@ 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), + 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic króna'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.hu_HU.php?r1=1.2&r2=1.3&ty=u Index: pear/Numbers_Words/Words/lang.hu_HU.php diff -u pear/Numbers_Words/Words/lang.hu_HU.php:1.2 pear/Numbers_Words/Words/lang.hu_HU.php:1.3 --- pear/Numbers_Words/Words/lang.hu_HU.php:1.2 Mon Sep 20 09:55:48 2004 +++ pear/Numbers_Words/Words/lang.hu_HU.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Nils Homp (Hungarian version) | // +----------------------------------------------------------------------+ // -// $Id: lang.hu_HU.php,v 1.2 2004/09/20 13:55:48 makler Exp $ +// $Id: lang.hu_HU.php,v 1.3 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Hungarian language. // NOTE: toCurrency() was not localized and is from the en_US class. @@ -152,6 +152,7 @@ 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), + 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic króna'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.pl.php?r1=1.2&r2=1.3&ty=u Index: pear/Numbers_Words/Words/lang.pl.php diff -u pear/Numbers_Words/Words/lang.pl.php:1.2 pear/Numbers_Words/Words/lang.pl.php:1.3 --- pear/Numbers_Words/Words/lang.pl.php:1.2 Thu Sep 2 07:07:59 2004 +++ pear/Numbers_Words/Words/lang.pl.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Authors: Piotr Klaban <makler@man.torun.pl> | // +----------------------------------------------------------------------+ // -// $Id: lang.pl.php,v 1.2 2004/09/02 11:07:59 makler Exp $ +// $Id: lang.pl.php,v 1.3 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Polish. // @@ -173,6 +173,7 @@ 'HKD' => array(array('dolar Hongkongu','dolary Hongkongu','dolarów Hongkongu'), array('cent', 'centy', 'centów')), 'HRK' => array(array('kuna','kuny','kun'), array('lipa','lipy','lip')), 'HUF' => array(array('forint','forinty','forintów'), array('filler','fillery','fillerów')), + 'ILS' => array(array('nowy szekel','nowe szekele','nowych szekeli'), array('agora','agory','agorot')), 'ISK' => array(array('korona islandzka','korony islandzkie','koron islandzkich'), array('aurar','aurar','aurar')), 'JPY' => array(array('jen','jeny','jenów'), array('sen','seny','senów')), 'LTL' => array(array('lit','lity','litów'), array('cent', 'centy', 'centów')), http://cvs.php.net/co.php/pear/Numbers_Words/Words/lang.cs.php?r=1.1&p=1 Index: pear/Numbers_Words/Words/lang.cs.php +++ pear/Numbers_Words/Words/lang.cs.php <?php /* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */ // // +----------------------------------------------------------------------+ // | PHP version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Petr 'PePa' Pavel <petr.pavel@pepa.info> | // +----------------------------------------------------------------------+ // // $Id: lang.cs.php,v 1.1 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Czech language. // /** * Class for translating numbers into Czech. * * @author Petr 'PePa' Pavel * @package Numbers_Words */ /** * Include needed files */ require_once("Numbers/Words.php"); /** * Class for translating numbers into Czech. * * @author Petr 'PePa' Pavel * @package Numbers_Words */ class Numbers_Words_cs extends Numbers_Words { // {{{ properties /** * Locale name * @var string * @access public */ var $locale = 'cs'; /** * Language name in English * @var string * @access public */ var $lang = 'Czech'; /** * Native language name * @var string * @access public */ var $lang_native = 'Czech'; /** * The word for the minus sign * @var string * @access private */ var $_minus = 'mínus'; // minus sign /** * The sufixes for exponents (singular and plural) * Names partly based on: * http://cs.wikipedia.org/wiki/P%C5%99edpony_soustavy_SI * the rest was translated from lang.en_GB.php * names verified by "Ustav pro jazyk cesky" only up to Septilion * (they could verify only the lingual matter - not the mathematical one) * @var array * @access private */ var $_exponent = array( 0 => array(''), 3 => array('tisíc','tisíce','tisíc'), 6 => array('milion','miliony','milionù'), 9 => array('miliarda','miliardy','miliard'), 12 => array('bilion','biliony','bilionù'), 15 => array('biliarda','biliardy','biliard'), 18 => array('trilion','triliony','trilionù'), 21 => array('triliarda','triliardy','triliard'), 24 => array('kvadrilion','kvadriliony','kvadrilionù'), 30 => array('kvintilion','kvintiliony','kvintilionù'), 36 => array('sextilion','sextiliony','sextilionù'), 42 => array('septilion','septiliony','septilionù'), 48 => array('oktilion','oktiliony','oktilionù'), 54 => array('nonilion','noniliony','nonilionù'), 60 => array('decilion','deciliony','decilionù'), 66 => array('undecilion','undeciliony','undecilionù'), 72 => array('duodecilion','duodeciliony','duodecilionù'), 78 => array('tredecilion','tredeciliony','tredecilionù'), 84 => array('kvatrodecilion','kvatrodeciliony','kvatrodecilionù'), 90 => array('kvindecilion','kvindeciliony','kvindecilionù'), 96 => array('sexdecilion','sexdeciliony','sexdecilionù'), 102 => array('septendecilion','septendeciliony','septendecilionù'), 108 => array('oktodecilion','oktodeciliony','oktodecilionù'), 114 => array('novemdecilion','novemdeciliony','novemdecilionù'), 120 => array('vigintilion','vigintiliony','vigintilionù'), 192 => array('duotrigintilion','duotrigintiliony','duotrigintilionù'), 600 => array('centilion','centiliony','centilionù') ); /** * The array containing the forms of Czech word for "hundred" * @var array * @access private */ var $_hundreds = array( 0 => 'sto', 'stì', 'sta', 'set' ); /** * The array containing the digits (indexed by the digits themselves). * @var array * @access private */ var $_digits = array( 0 => 'nula', 'jedna', 'dva', 'tøi', 'ètyøi', 'pìt', '¹est', 'sedm', 'osm', 'devìt' ); /** * The word separator * @var string * @access private */ var $_sep = ' '; // }}} // {{{ toWords() /** * Converts a number to its word representation * in Czech language * * @param integer $num An integer between -infinity and infinity inclusive :) * that need to be converted to words * @param integer $power The power of ten for the rest of the number to the right. * Optional, defaults to 0. * @param integer $powsuffix The power name to be added to the end of the return string. * Used internally. Optional, defaults to ''. * * @return string The corresponding word representation * * @access public * @author Petr 'PePa' Pavel <petr.pavel@pepa.info> * @since PHP 4.2.3 */ function toWords($num, $power = 0, $powsuffix = '') { // print "<br>$num,$power,$powsuffix<br>"; $ret = ''; // add a minus sign if (substr($num, 0, 1) == '-') { $ret = $this->_sep . $this->_minus; $num = substr($num, 1); } // strip excessive zero signs and spaces $num = trim($num); $num = preg_replace('/^0+/','',$num); if (strlen($num) > 3) { $maxp = strlen($num)-1; $curp = $maxp; for ($p = $maxp; $p > 0; --$p) { // power // check for highest power if (isset($this->_exponent[$p])) { // send substr from $curp to $p $snum = substr($num, $maxp - $curp, $curp - $p + 1); $snum = preg_replace('/^0+/','',$snum); if ($snum !== '') { $cursuffix = $this->_exponent[$power][count($this->_exponent[$power])-1]; if ($powsuffix != '') $cursuffix .= $this->_sep . $powsuffix; $ret .= $this->toWords($snum, $p, $cursuffix); } $curp = $p - 1; continue; } } $num = substr($num, $maxp - $curp, $curp - $p + 1); if ($num == 0) { return $ret; } } elseif ($num == 0 || $num == '') { return $this->_sep . $this->_digits[0]; } $h = $t = $d = 0; switch(strlen($num)) { case 3: $h = (int)substr($num,-3,1); case 2: $t = (int)substr($num,-2,1); case 1: $d = (int)substr($num,-1,1); break; case 0: return; break; } if ($h) { // inflection of the word "hundred" if ($h == 1) $ret .= $this->_sep . $this->_hundreds[0]; elseif ($h == 2) $ret .= $this->_sep . "dvì" . $this->_sep . $this->_hundreds[1]; elseif ( ($h > 1) && ($h < 5) ) $ret .= $this->_sep . $this->_digits[$h] . $this->_sep . $this->_hundreds[2]; else //if ($h >= 5) $ret .= $this->_sep . $this->_digits[$h] . $this->_sep . $this->_hundreds[3]; // in English only - add ' and' for [1-9]01..[1-9]99 // (also for 1001..1099, 10001..10099 but it is harder) // for now it is switched off, maybe some language purists // can force me to enable it, or to remove it completely // if (($t + $d) > 0) // $ret .= $this->_sep . 'and'; } // ten, twenty etc. switch ($t) { case 2: case 3: case 4: $ret .= $this->_sep . $this->_digits[$t] . 'cet'; break; case 5: $ret .= $this->_sep . 'padesát'; break; case 6: $ret .= $this->_sep . '¹edesát'; break; case 7: $ret .= $this->_sep . 'sedmdesát'; break; case 8: $ret .= $this->_sep . 'osmdesát'; break; case 9: $ret .= $this->_sep . 'devadesát'; break; case 1: switch ($d) { case 0: $ret .= $this->_sep . 'deset'; break; case 1: $ret .= $this->_sep . 'jedenáct'; break; case 4: $ret .= $this->_sep . 'ètrnáct'; break; case 5: $ret .= $this->_sep . 'patnáct'; break; case 9: $ret .= $this->_sep . 'devatenáct'; break; case 2: case 3: case 6: case 7: case 8: $ret .= $this->_sep . $this->_digits[$d] . 'náct'; break; } break; } if ($t != 1 && $d > 0 && ($power == 0 || $d > 1)) { // $ret .= $this->_sep . $this->_digits[$d]; } if ($power > 0) { if (isset($this->_exponent[$power])) $lev = $this->_exponent[$power]; if (!isset($lev) || !is_array($lev)) return null; // inflection of exponental words if ($num == 1) $idx = 0; elseif ( ($num > 1) && ($num < 5) ) $idx = 1; else //if ($num >= 5) $idx = 2; $ret .= $this->_sep . $lev[$idx]; } if ($powsuffix != '') $ret .= $this->_sep . $powsuffix; return $ret; } // }}} } ?> http://cvs.php.net/co.php/pear/Numbers_Words/Words/lang.he.php?r=1.1&p=1 Index: pear/Numbers_Words/Words/lang.he.php +++ pear/Numbers_Words/Words/lang.he.php <?php /* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */ // // +----------------------------------------------------------------------+ // | PHP version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Hadar Porat | // +----------------------------------------------------------------------+ // // $Id: lang.he.php,v 1.1 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Hebrew language. // /** * Class for translating numbers into Hebrew. * * @author Hadar Porat * @package Numbers_Words */ /** * Include needed files */ require_once("Numbers/Words.php"); /** * Class for translating numbers into Hebrew. * * @author Hadar Porat * @package Numbers_Words */ class Numbers_Words_he extends Numbers_Words { // {{{ properties /** * Locale name * @var string * @access public */ var $locale = 'he'; /** * Language name in English * @var string * @access public */ var $lang = 'Hebrew'; /** * Native language name * @var string * @access public */ var $lang_native = '×¢×ר×ת'; /** * The word for the minus sign * @var string * @access private */ var $_minus = 'minus'; // minus sign /** * The sufixes for exponents (singular and plural) * Names partly based on: * http://home.earthlink.net/~mrob/pub/math/largenum.html * http://mathforum.org/dr.math/faq/faq.large.numbers.html * http://www.mazes.com/AmericanNumberingSystem.html * @var array * @access private */ var $_exponent = array( 0 => array(''), 3 => array('××פ××'), 6 => array('××××××'), 9 => array('××××××'), 12 => array('×ר×××××'), 15 => array('×§×××ר×××××'), 18 => array('×§×××× ××××××'), 21 => array('sextillion'), 24 => array('septillion'), 27 => array('octillion'), 30 => array('nonillion'), 33 => array('decillion'), 36 => array('undecillion'), 39 => array('duodecillion'), 42 => array('tredecillion'), 45 => array('quattuordecillion'), 48 => array('quindecillion'), 51 => array('sexdecillion'), 54 => array('septendecillion'), 57 => array('octodecillion'), 60 => array('novemdecillion'), 63 => array('vigintillion'), 66 => array('unvigintillion'), 69 => array('duovigintillion'), 72 => array('trevigintillion'), 75 => array('quattuorvigintillion'), 78 => array('quinvigintillion'), 81 => array('sexvigintillion'), 84 => array('septenvigintillion'), 87 => array('octovigintillion'), 90 => array('novemvigintillion'), 93 => array('trigintillion'), 96 => array('untrigintillion'), 99 => array('duotrigintillion'), // 100 => array('googol') - not latin name // 10^googol = 1 googolplex 102 => array('trestrigintillion'), 105 => array('quattuortrigintillion'), 108 => array('quintrigintillion'), 111 => array('sextrigintillion'), 114 => array('septentrigintillion'), 117 => array('octotrigintillion'), 120 => array('novemtrigintillion'), 123 => array('quadragintillion'), 126 => array('unquadragintillion'), 129 => array('duoquadragintillion'), 132 => array('trequadragintillion'), 135 => array('quattuorquadragintillion'), 138 => array('quinquadragintillion'), 141 => array('sexquadragintillion'), 144 => array('septenquadragintillion'), 147 => array('octoquadragintillion'), 150 => array('novemquadragintillion'), 153 => array('quinquagintillion'), 156 => array('unquinquagintillion'), 159 => array('duoquinquagintillion'), 162 => array('trequinquagintillion'), 165 => array('quattuorquinquagintillion'), 168 => array('quinquinquagintillion'), 171 => array('sexquinquagintillion'), 174 => array('septenquinquagintillion'), 177 => array('octoquinquagintillion'), 180 => array('novemquinquagintillion'), 183 => array('sexagintillion'), 186 => array('unsexagintillion'), 189 => array('duosexagintillion'), 192 => array('tresexagintillion'), 195 => array('quattuorsexagintillion'), 198 => array('quinsexagintillion'), 201 => array('sexsexagintillion'), 204 => array('septensexagintillion'), 207 => array('octosexagintillion'), 210 => array('novemsexagintillion'), 213 => array('septuagintillion'), 216 => array('unseptuagintillion'), 219 => array('duoseptuagintillion'), 222 => array('treseptuagintillion'), 225 => array('quattuorseptuagintillion'), 228 => array('quinseptuagintillion'), 231 => array('sexseptuagintillion'), 234 => array('septenseptuagintillion'), 237 => array('octoseptuagintillion'), 240 => array('novemseptuagintillion'), 243 => array('octogintillion'), 246 => array('unoctogintillion'), 249 => array('duooctogintillion'), 252 => array('treoctogintillion'), 255 => array('quattuoroctogintillion'), 258 => array('quinoctogintillion'), 261 => array('sexoctogintillion'), 264 => array('septoctogintillion'), 267 => array('octooctogintillion'), 270 => array('novemoctogintillion'), 273 => array('nonagintillion'), 276 => array('unnonagintillion'), 279 => array('duononagintillion'), 282 => array('trenonagintillion'), 285 => array('quattuornonagintillion'), 288 => array('quinnonagintillion'), 291 => array('sexnonagintillion'), 294 => array('septennonagintillion'), 297 => array('octononagintillion'), 300 => array('novemnonagintillion'), 303 => array('centillion'), 309 => array('duocentillion'), 312 => array('trecentillion'), 366 => array('primo-vigesimo-centillion'), 402 => array('trestrigintacentillion'), 603 => array('ducentillion'), 624 => array('septenducentillion'), // bug on a earthlink page: 903 => array('trecentillion'), 2421 => array('sexoctingentillion'), 3003 => array('millillion'), 3000003 => array('milli-millillion') ); /** * The array containing the digits (indexed by the digits themselves). * @var array * @access private */ var $_digits = array( 0 => '×פס', '×××', '×©× ×××', 'ש××ש×', '×ר××¢×', '×××ש×', 'ש×ש×', 'ש××¢×', 'ש××× ×', 'תשע×' ); var $_digits_female = array( 0 => '×פס', '××ת', 'שת×××', 'ש××ש', '×ר××¢', '××ש', 'שש', 'ש××¢', 'ש××× ×', 'תשע' ); var $_digits_ten = array( 2 => 'עשר××', 'ש××ש××', '×ר××¢××', '×××ש××', 'ש×ש××', 'ש××¢××', 'ש××× ××', 'תשע××' ); var $_digits_female = array( 0 => '×פס', '××ת', 'שת×××', 'ש××ש', '×ר××¢', '××ש', 'שש', 'ש××¢', 'ש××× ×', 'תשע' ); var $digits_hundreds = array( 0 => '', '×××', '×©× ×-×××ת', 'ש××ש-×××ת', '×ר××¢-×××ת', '××ש-×××ת', 'שש-×××ת', 'ש××¢-×××ת', 'ש××× ×-×××ת', 'תשע-×××ת' ); /** * The word separator * @var string * @access private */ var $_sep = ' '; var $_sep_hundred = '-'; var $_sep_ten = ' ×'; /** * The currency names (based on the below links, * informations from central bank websites and on encyclopedias) * * @var array * @link http://30-03-67.dreamstation.com/currency_alfa.htm World Currency Information * @link http://www.jhall.demon.co.uk/currency/by_abbrev.html World currencies * @link http://www.shoestring.co.kr/world/p.visa/change.htm Currency names in English * @access private */ var $_currency_names = array( 'ALL' => array(array('lek'), array('qindarka')), 'AUD' => array(array('Australian dollar'), array('cent')), 'BAM' => array(array('convertible marka'), array('fenig')), 'BGN' => array(array('lev'), array('stotinka')), 'BRL' => array(array('real'), array('centavos')), 'BYR' => array(array('Belarussian rouble'), array('kopiejka')), 'CAD' => array(array('Canadian dollar'), array('cent')), 'CHF' => array(array('Swiss franc'), array('rapp')), 'CYP' => array(array('Cypriot pound'), array('cent')), 'CZK' => array(array('Czech koruna'), array('halerz')), 'DKK' => array(array('Danish krone'), array('ore')), 'EEK' => array(array('kroon'), array('senti')), 'EUR' => array(array('euro'), array('euro-cent')), 'GBP' => array(array('pound', 'pounds'), array('pence')), 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic kr�na'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), 'LVL' => array(array('lat'), array('sentim')), 'MKD' => array(array('Macedonian dinar'), array('deni')), 'MTL' => array(array('Maltese lira'), array('centym')), 'NIS' => array(array('שק××× ××ש××'), array('nis')), // need more info if NIS or ILS 'NOK' => array(array('Norwegian krone'), array('oere')), 'PLN' => array(array('zloty', 'zlotys'), array('grosz')), 'ROL' => array(array('Romanian leu'), array('bani')), 'RUB' => array(array('Russian Federation rouble'), array('kopiejka')), 'SEK' => array(array('Swedish krona'), array('oere')), 'SIT' => array(array('Tolar'), array('stotinia')), 'SKK' => array(array('Slovak koruna'), array()), 'TRL' => array(array('lira'), array('kuru�')), 'UAH' => array(array('hryvna'), array('cent')), 'USD' => array(array('dollar'), array('cent')), 'YUM' => array(array('dinars'), array('para')), 'ZAR' => array(array('rand'), array('cent')) ); /** * The default currency name * @var string * @access public */ var $def_currency = 'NIS'; // }}} // {{{ toWords() /** * Converts a number to its word representation * * @param integer $num An integer between -infinity and infinity inclusive :) * that need to be converted to words * @param integer $power The power of ten for the rest of the number to the right. * Optional, defaults to 0. * @param integer $powsuffix The power name to be added to the end of the return string. * Used internally. Optional, defaults to ''. * * @return string The corresponding word representation * * @access public * @author Piotr Klaban <makler@man.torun.pl> * @since PHP 4.2.3 */ function toWords($num, $power = 0, $powsuffix = '') { $ret = ''; // add a minus sign if (substr($num, 0, 1) == '-') { $ret = $this->_sep . $this->_minus; $num = substr($num, 1); } // strip excessive zero signs and spaces $num = trim($num); $num = preg_replace('/^0+/','',$num); if (strlen($num) > 3) { $maxp = strlen($num)-1; $curp = $maxp; for ($p = $maxp; $p > 0; --$p) { // power // check for highest power if (isset($this->_exponent[$p])) { // send substr from $curp to $p $snum = substr($num, $maxp - $curp, $curp - $p + 1); $snum = preg_replace('/^0+/','',$snum); if ($snum !== '') { $cursuffix = $this->_exponent[$power][count($this->_exponent[$power])-1]; if ($powsuffix != '') $cursuffix .= $this->_sep . $powsuffix; $ret .= $this->toWords($snum, $p, $cursuffix); } $curp = $p - 1; continue; } } $num = substr($num, $maxp - $curp, $curp - $p + 1); if ($num == 0) { return $ret; } } elseif ($num == 0 || $num == '') { return $this->_sep . $this->_digits[0]; } $h = $t = $d = 0; switch(strlen($num)) { case 3: $h = (int)substr($num,-3,1); case 2: $t = (int)substr($num,-2,1); case 1: $d = (int)substr($num,-1,1); break; case 0: return; break; } if ($h) { $ret .= $this->_sep . $this->digits_hundreds[$h]; // in English only - add ' and' for [1-9]01..[1-9]99 // (also for 1001..1099, 10001..10099 but it is harder) // for now it is switched off, maybe some language purists // can force me to enable it, or to remove it completely // if (($t + $d) > 0) // $ret .= $this->_sep . 'and'; } // ten, twenty etc. switch ($t) { case 9: case 8: case 7: case 6: case 5: case 4: case 3: case 2: $ret .= $this->_sep . $this->_digits_ten[$t]; break; case 1: switch ($d) { case 0: $ret .= $this->_sep . 'עשר'; break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: $ret .= $this->_sep . $this->_digits[$d] . '-עשר'; break; } break; } if ($t != 1 && $d > 0) { // add digits only in <0>,<1,9> and <21,inf> // add minus sign between [2-9] and digit if ($t > 1) { $ret .= $this -> _sep_ten . $this->_digits[$d]; } else { if (strlen($ret)>0) $ret .= $this->_sep . '×' . $this->_digits[$d]; else $ret .= $this->_sep . $this->_digits[$d]; } } if ($power > 0) { if (isset($this->_exponent[$power])) $lev = $this->_exponent[$power]; if (!isset($lev) || !is_array($lev)) return null; $ret .= $this->_sep . $lev[0]; } if ($powsuffix != '') $ret .= $this->_sep . $powsuffix; return $ret; } // }}} // {{{ toCurrency() /** * Converts a currency value to its word representation * (with monetary units) * * @param integer $int_curr An international currency symbol * as defined by the ISO 4217 standard (three characters) * @param integer $decimal A money total amount without fraction part (e.g. amount of dollars) * @param integer $fraction Fractional part of the money amount (e.g. amount of cents) * Optional. Defaults to false. * * @return string The corresponding word representation for the currency * * @access public * @author Piotr Klaban <makler@man.torun.pl> * @since Numbers_Words 0.4 */ function toCurrencyWords($int_curr, $decimal, $fraction = false) { $int_curr = strtoupper($int_curr); if (!isset($this->_currency_names[$int_curr])) { $int_curr = $this->def_currency; } $curr_names = $this->_currency_names[$int_curr]; $ret = trim($this->toWords($decimal)); $lev = ($decimal == 1) ? 0 : 1; if ($lev > 0) { if (count($curr_names[0]) > 1) { $ret .= $this->_sep . $curr_names[0][$lev]; } else { $ret .= $this->_sep . $curr_names[0][0] . ''; } } else { $ret .= $this->_sep . $curr_names[0][0]; } if ($fraction !== false) { $ret .= $this->_sep . trim($this->toWords($fraction)); $lev = ($fraction == 1) ? 0 : 1; if ($lev > 0) { if (count($curr_names[1]) > 1) { $ret .= $this->_sep . $curr_names[1][$lev]; } else { $ret .= $this->_sep . $curr_names[1][0] . ''; } } else { $ret .= $this->_sep . $curr_names[1][0]; } } return $ret; } // }}} } ?>
http://cvs.php.net/diff.php/pear/Numbers_Words/ChangeLog?r1=1.6&r2=1.7&ty=u Index: pear/Numbers_Words/ChangeLog diff -u pear/Numbers_Words/ChangeLog:1.6 pear/Numbers_Words/ChangeLog:1.7 --- pear/Numbers_Words/ChangeLog:1.6 Tue Jan 11 09:30:33 2005 +++ pear/Numbers_Words/ChangeLog Mon Feb 28 08:22:50 2005 @@ -1,3 +1,13 @@ +2005-02-28 + * Numbers_Words: Version 0.13.0 released. + * support for a new currency ILS (or NIS) for New Israeli Sheqel + +2005-02-15 + * Words/lang.cs.php: New language file: cs for Czech (Thanks to Petr 'PePa' Pavel) + +2005-02-03 + * Words/lang.he.php: New language file: he for Hebrew (Thanks to Hadar Porat) + 2005-01-11 * Numbers_Words: Version 0.12.0 released. * Words/lang.fr_BE.php: New language file: fr_BE for French (Belgium) (Thanks to Philippe Bajoit). http://cvs.php.net/diff.php/pear/Numbers_Words/README?r1=1.6&r2=1.7&ty=u Index: pear/Numbers_Words/README diff -u pear/Numbers_Words/README:1.6 pear/Numbers_Words/README:1.7 --- pear/Numbers_Words/README:1.6 Tue Jan 11 09:30:33 2005 +++ pear/Numbers_Words/README Mon Feb 28 08:22:50 2005 @@ -65,6 +65,9 @@ bg - Bulgarian language (in WIN-1251 charset). Author: Kouber Saparev + cs - Czech language. + Author: Petr 'PePa' Pavel + de - German language. Author: Piotr Klaban @@ -100,6 +103,9 @@ fr_BE - French (Belgium) language. Author: Kouber Saparev, Philippe Bajoit + he - Hebrew language. + Author: Hadar Porat + hu_HU - Hungarian language. Author: Nils Homp http://cvs.php.net/diff.php/pear/Numbers_Words/package.xml?r1=1.8&r2=1.9&ty=u Index: pear/Numbers_Words/package.xml diff -u pear/Numbers_Words/package.xml:1.8 pear/Numbers_Words/package.xml:1.9 --- pear/Numbers_Words/package.xml:1.8 Tue Jan 11 09:50:13 2005 +++ pear/Numbers_Words/package.xml Mon Feb 28 08:22:50 2005 @@ -13,21 +13,23 @@ The following languages are supported: * bg (Bulgarian) by Kouber Saparev - * de (German) + * cs (Czech) by Petr 'PePa' Pavel + * de (German) by me * dk (Danish) by Jesper Veggerby * ee (Estonian) by Erkki Saarniit - * en_100 (Donald Knuth system, English) - * en_GB (British English) - * en_US (American English) + * en_100 (Donald Knuth system, English) by me + * en_GB (British English) by me + * en_US (American English) by me * es (Spanish Castellano) by Xavier Noguer * es_AR (Argentinian Spanish) by Martin Marrese * fr (French) by Kouber Saparev * fr_BE (French Belgium) by Kouber Saparev and Philippe Bajoit + * he (Hebrew) by Hadar Porat * hu_HU (Hungarian) by Nils Homp * id (Indonesian) by Ernas M. Jamil and Arif Rifai Dwiyanto * it_IT (Italian) by Filippo Beltramini and Davide Caironi * lt (Lithuanian) by Laurynas Butkus - * pl (Polish) + * pl (Polish) by me * pt_BR (Brazilian Portuguese) by Marcelo Subtil Marcal and Mario H.C.T. * ru (Russian) by Andrey Demenev * sv (Swedish) by Robin Ericsson @@ -41,14 +43,15 @@ </maintainer> </maintainers> <release> - <version>0.12.0</version> - <date>2005-01-11</date> + <version>0.13.0</version> + <date>2005-02-28</date> <license>PHP License</license> <state>beta</state> - <notes>New file for French (Belgium) language (Thanks to Philippe Bajoit).</notes> + <notes>New files for Czech (thanks to Petr 'PePa' Pavel) and Hebrew (thanks to Hadar Porat) languages.</notes> <filelist> <file role="php" baseinstalldir="Numbers" name="Words.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.bg.php"/> + <file role="php" baseinstalldir="Numbers" name="Words/lang.cs.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.de.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.dk.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.ee.php"/> @@ -59,6 +62,7 @@ <file role="php" baseinstalldir="Numbers" name="Words/lang.es_AR.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.fr.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.fr_BE.php"/> + <file role="php" baseinstalldir="Numbers" name="Words/lang.he.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.hu_HU.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.id.php"/> <file role="php" baseinstalldir="Numbers" name="Words/lang.it_IT.php"/> @@ -77,6 +81,13 @@ </release> <changelog> <release> + <version>0.12.0</version> + <date>2005-01-11</date> + <license>PHP License</license> + <state>beta</state> + <notes>New file for French (Belgium) language (Thanks to Philippe Bajoit).</notes> + </release> + <release> <version>0.11.0</version> <date>2004-10-22</date> <license>PHP License</license> http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.en_US.php?r1=1.2&r2=1.3&ty=u Index: pear/Numbers_Words/Words/lang.en_US.php diff -u pear/Numbers_Words/Words/lang.en_US.php:1.2 pear/Numbers_Words/Words/lang.en_US.php:1.3 --- pear/Numbers_Words/Words/lang.en_US.php:1.2 Thu Sep 2 07:07:59 2004 +++ pear/Numbers_Words/Words/lang.en_US.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Authors: Piotr Klaban <makler@man.torun.pl> | // +----------------------------------------------------------------------+ // -// $Id: lang.en_US.php,v 1.2 2004/09/02 11:07:59 makler Exp $ +// $Id: lang.en_US.php,v 1.3 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in American English language. // @@ -244,6 +244,7 @@ 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), + 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic króna'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.es_AR.php?r1=1.1&r2=1.2&ty=u Index: pear/Numbers_Words/Words/lang.es_AR.php diff -u pear/Numbers_Words/Words/lang.es_AR.php:1.1 pear/Numbers_Words/Words/lang.es_AR.php:1.2 --- pear/Numbers_Words/Words/lang.es_AR.php:1.1 Thu Sep 2 07:07:59 2004 +++ pear/Numbers_Words/Words/lang.es_AR.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Authors: Martin Marrese <mmare@mecon.gov.ar> | // | Based On: lang_es.php - Xavier Noguer | // +----------------------------------------------------------------------+ -// $Id: lang.es_AR.php,v 1.1 2004/09/02 11:07:59 makler Exp $ +// $Id: lang.es_AR.php,v 1.2 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Argentinian Spanish // @@ -139,6 +139,7 @@ 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), + 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic króna'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.hu_HU.php?r1=1.2&r2=1.3&ty=u Index: pear/Numbers_Words/Words/lang.hu_HU.php diff -u pear/Numbers_Words/Words/lang.hu_HU.php:1.2 pear/Numbers_Words/Words/lang.hu_HU.php:1.3 --- pear/Numbers_Words/Words/lang.hu_HU.php:1.2 Mon Sep 20 09:55:48 2004 +++ pear/Numbers_Words/Words/lang.hu_HU.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Nils Homp (Hungarian version) | // +----------------------------------------------------------------------+ // -// $Id: lang.hu_HU.php,v 1.2 2004/09/20 13:55:48 makler Exp $ +// $Id: lang.hu_HU.php,v 1.3 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Hungarian language. // NOTE: toCurrency() was not localized and is from the en_US class. @@ -152,6 +152,7 @@ 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), + 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic króna'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), http://cvs.php.net/diff.php/pear/Numbers_Words/Words/lang.pl.php?r1=1.2&r2=1.3&ty=u Index: pear/Numbers_Words/Words/lang.pl.php diff -u pear/Numbers_Words/Words/lang.pl.php:1.2 pear/Numbers_Words/Words/lang.pl.php:1.3 --- pear/Numbers_Words/Words/lang.pl.php:1.2 Thu Sep 2 07:07:59 2004 +++ pear/Numbers_Words/Words/lang.pl.php Mon Feb 28 08:22:51 2005 @@ -17,7 +17,7 @@ // | Authors: Piotr Klaban <makler@man.torun.pl> | // +----------------------------------------------------------------------+ // -// $Id: lang.pl.php,v 1.2 2004/09/02 11:07:59 makler Exp $ +// $Id: lang.pl.php,v 1.3 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Polish. // @@ -173,6 +173,7 @@ 'HKD' => array(array('dolar Hongkongu','dolary Hongkongu','dolarów Hongkongu'), array('cent', 'centy', 'centów')), 'HRK' => array(array('kuna','kuny','kun'), array('lipa','lipy','lip')), 'HUF' => array(array('forint','forinty','forintów'), array('filler','fillery','fillerów')), + 'ILS' => array(array('nowy szekel','nowe szekele','nowych szekeli'), array('agora','agory','agorot')), 'ISK' => array(array('korona islandzka','korony islandzkie','koron islandzkich'), array('aurar','aurar','aurar')), 'JPY' => array(array('jen','jeny','jenów'), array('sen','seny','senów')), 'LTL' => array(array('lit','lity','litów'), array('cent', 'centy', 'centów')), http://cvs.php.net/co.php/pear/Numbers_Words/Words/lang.cs.php?r=1.1&p=1 Index: pear/Numbers_Words/Words/lang.cs.php +++ pear/Numbers_Words/Words/lang.cs.php <?php /* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */ // // +----------------------------------------------------------------------+ // | PHP version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Petr 'PePa' Pavel <petr.pavel@pepa.info> | // +----------------------------------------------------------------------+ // // $Id: lang.cs.php,v 1.1 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Czech language. // /** * Class for translating numbers into Czech. * * @author Petr 'PePa' Pavel * @package Numbers_Words */ /** * Include needed files */ require_once("Numbers/Words.php"); /** * Class for translating numbers into Czech. * * @author Petr 'PePa' Pavel * @package Numbers_Words */ class Numbers_Words_cs extends Numbers_Words { // {{{ properties /** * Locale name * @var string * @access public */ var $locale = 'cs'; /** * Language name in English * @var string * @access public */ var $lang = 'Czech'; /** * Native language name * @var string * @access public */ var $lang_native = 'Czech'; /** * The word for the minus sign * @var string * @access private */ var $_minus = 'mínus'; // minus sign /** * The sufixes for exponents (singular and plural) * Names partly based on: * http://cs.wikipedia.org/wiki/P%C5%99edpony_soustavy_SI * the rest was translated from lang.en_GB.php * names verified by "Ustav pro jazyk cesky" only up to Septilion * (they could verify only the lingual matter - not the mathematical one) * @var array * @access private */ var $_exponent = array( 0 => array(''), 3 => array('tisíc','tisíce','tisíc'), 6 => array('milion','miliony','milionù'), 9 => array('miliarda','miliardy','miliard'), 12 => array('bilion','biliony','bilionù'), 15 => array('biliarda','biliardy','biliard'), 18 => array('trilion','triliony','trilionù'), 21 => array('triliarda','triliardy','triliard'), 24 => array('kvadrilion','kvadriliony','kvadrilionù'), 30 => array('kvintilion','kvintiliony','kvintilionù'), 36 => array('sextilion','sextiliony','sextilionù'), 42 => array('septilion','septiliony','septilionù'), 48 => array('oktilion','oktiliony','oktilionù'), 54 => array('nonilion','noniliony','nonilionù'), 60 => array('decilion','deciliony','decilionù'), 66 => array('undecilion','undeciliony','undecilionù'), 72 => array('duodecilion','duodeciliony','duodecilionù'), 78 => array('tredecilion','tredeciliony','tredecilionù'), 84 => array('kvatrodecilion','kvatrodeciliony','kvatrodecilionù'), 90 => array('kvindecilion','kvindeciliony','kvindecilionù'), 96 => array('sexdecilion','sexdeciliony','sexdecilionù'), 102 => array('septendecilion','septendeciliony','septendecilionù'), 108 => array('oktodecilion','oktodeciliony','oktodecilionù'), 114 => array('novemdecilion','novemdeciliony','novemdecilionù'), 120 => array('vigintilion','vigintiliony','vigintilionù'), 192 => array('duotrigintilion','duotrigintiliony','duotrigintilionù'), 600 => array('centilion','centiliony','centilionù') ); /** * The array containing the forms of Czech word for "hundred" * @var array * @access private */ var $_hundreds = array( 0 => 'sto', 'stì', 'sta', 'set' ); /** * The array containing the digits (indexed by the digits themselves). * @var array * @access private */ var $_digits = array( 0 => 'nula', 'jedna', 'dva', 'tøi', 'ètyøi', 'pìt', '¹est', 'sedm', 'osm', 'devìt' ); /** * The word separator * @var string * @access private */ var $_sep = ' '; // }}} // {{{ toWords() /** * Converts a number to its word representation * in Czech language * * @param integer $num An integer between -infinity and infinity inclusive :) * that need to be converted to words * @param integer $power The power of ten for the rest of the number to the right. * Optional, defaults to 0. * @param integer $powsuffix The power name to be added to the end of the return string. * Used internally. Optional, defaults to ''. * * @return string The corresponding word representation * * @access public * @author Petr 'PePa' Pavel <petr.pavel@pepa.info> * @since PHP 4.2.3 */ function toWords($num, $power = 0, $powsuffix = '') { // print "<br>$num,$power,$powsuffix<br>"; $ret = ''; // add a minus sign if (substr($num, 0, 1) == '-') { $ret = $this->_sep . $this->_minus; $num = substr($num, 1); } // strip excessive zero signs and spaces $num = trim($num); $num = preg_replace('/^0+/','',$num); if (strlen($num) > 3) { $maxp = strlen($num)-1; $curp = $maxp; for ($p = $maxp; $p > 0; --$p) { // power // check for highest power if (isset($this->_exponent[$p])) { // send substr from $curp to $p $snum = substr($num, $maxp - $curp, $curp - $p + 1); $snum = preg_replace('/^0+/','',$snum); if ($snum !== '') { $cursuffix = $this->_exponent[$power][count($this->_exponent[$power])-1]; if ($powsuffix != '') $cursuffix .= $this->_sep . $powsuffix; $ret .= $this->toWords($snum, $p, $cursuffix); } $curp = $p - 1; continue; } } $num = substr($num, $maxp - $curp, $curp - $p + 1); if ($num == 0) { return $ret; } } elseif ($num == 0 || $num == '') { return $this->_sep . $this->_digits[0]; } $h = $t = $d = 0; switch(strlen($num)) { case 3: $h = (int)substr($num,-3,1); case 2: $t = (int)substr($num,-2,1); case 1: $d = (int)substr($num,-1,1); break; case 0: return; break; } if ($h) { // inflection of the word "hundred" if ($h == 1) $ret .= $this->_sep . $this->_hundreds[0]; elseif ($h == 2) $ret .= $this->_sep . "dvì" . $this->_sep . $this->_hundreds[1]; elseif ( ($h > 1) && ($h < 5) ) $ret .= $this->_sep . $this->_digits[$h] . $this->_sep . $this->_hundreds[2]; else //if ($h >= 5) $ret .= $this->_sep . $this->_digits[$h] . $this->_sep . $this->_hundreds[3]; // in English only - add ' and' for [1-9]01..[1-9]99 // (also for 1001..1099, 10001..10099 but it is harder) // for now it is switched off, maybe some language purists // can force me to enable it, or to remove it completely // if (($t + $d) > 0) // $ret .= $this->_sep . 'and'; } // ten, twenty etc. switch ($t) { case 2: case 3: case 4: $ret .= $this->_sep . $this->_digits[$t] . 'cet'; break; case 5: $ret .= $this->_sep . 'padesát'; break; case 6: $ret .= $this->_sep . '¹edesát'; break; case 7: $ret .= $this->_sep . 'sedmdesát'; break; case 8: $ret .= $this->_sep . 'osmdesát'; break; case 9: $ret .= $this->_sep . 'devadesát'; break; case 1: switch ($d) { case 0: $ret .= $this->_sep . 'deset'; break; case 1: $ret .= $this->_sep . 'jedenáct'; break; case 4: $ret .= $this->_sep . 'ètrnáct'; break; case 5: $ret .= $this->_sep . 'patnáct'; break; case 9: $ret .= $this->_sep . 'devatenáct'; break; case 2: case 3: case 6: case 7: case 8: $ret .= $this->_sep . $this->_digits[$d] . 'náct'; break; } break; } if ($t != 1 && $d > 0 && ($power == 0 || $d > 1)) { // $ret .= $this->_sep . $this->_digits[$d]; } if ($power > 0) { if (isset($this->_exponent[$power])) $lev = $this->_exponent[$power]; if (!isset($lev) || !is_array($lev)) return null; // inflection of exponental words if ($num == 1) $idx = 0; elseif ( ($num > 1) && ($num < 5) ) $idx = 1; else //if ($num >= 5) $idx = 2; $ret .= $this->_sep . $lev[$idx]; } if ($powsuffix != '') $ret .= $this->_sep . $powsuffix; return $ret; } // }}} } ?> http://cvs.php.net/co.php/pear/Numbers_Words/Words/lang.he.php?r=1.1&p=1 Index: pear/Numbers_Words/Words/lang.he.php +++ pear/Numbers_Words/Words/lang.he.php <?php /* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */ // // +----------------------------------------------------------------------+ // | PHP version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Hadar Porat | // +----------------------------------------------------------------------+ // // $Id: lang.he.php,v 1.1 2005/02/28 13:22:51 makler Exp $ // // Numbers_Words class extension to spell numbers in Hebrew language. // /** * Class for translating numbers into Hebrew. * * @author Hadar Porat * @package Numbers_Words */ /** * Include needed files */ require_once("Numbers/Words.php"); /** * Class for translating numbers into Hebrew. * * @author Hadar Porat * @package Numbers_Words */ class Numbers_Words_he extends Numbers_Words { // {{{ properties /** * Locale name * @var string * @access public */ var $locale = 'he'; /** * Language name in English * @var string * @access public */ var $lang = 'Hebrew'; /** * Native language name * @var string * @access public */ var $lang_native = '×¢×ר×ת'; /** * The word for the minus sign * @var string * @access private */ var $_minus = 'minus'; // minus sign /** * The sufixes for exponents (singular and plural) * Names partly based on: * http://home.earthlink.net/~mrob/pub/math/largenum.html * http://mathforum.org/dr.math/faq/faq.large.numbers.html * http://www.mazes.com/AmericanNumberingSystem.html * @var array * @access private */ var $_exponent = array( 0 => array(''), 3 => array('××פ××'), 6 => array('××××××'), 9 => array('××××××'), 12 => array('×ר×××××'), 15 => array('×§×××ר×××××'), 18 => array('×§×××× ××××××'), 21 => array('sextillion'), 24 => array('septillion'), 27 => array('octillion'), 30 => array('nonillion'), 33 => array('decillion'), 36 => array('undecillion'), 39 => array('duodecillion'), 42 => array('tredecillion'), 45 => array('quattuordecillion'), 48 => array('quindecillion'), 51 => array('sexdecillion'), 54 => array('septendecillion'), 57 => array('octodecillion'), 60 => array('novemdecillion'), 63 => array('vigintillion'), 66 => array('unvigintillion'), 69 => array('duovigintillion'), 72 => array('trevigintillion'), 75 => array('quattuorvigintillion'), 78 => array('quinvigintillion'), 81 => array('sexvigintillion'), 84 => array('septenvigintillion'), 87 => array('octovigintillion'), 90 => array('novemvigintillion'), 93 => array('trigintillion'), 96 => array('untrigintillion'), 99 => array('duotrigintillion'), // 100 => array('googol') - not latin name // 10^googol = 1 googolplex 102 => array('trestrigintillion'), 105 => array('quattuortrigintillion'), 108 => array('quintrigintillion'), 111 => array('sextrigintillion'), 114 => array('septentrigintillion'), 117 => array('octotrigintillion'), 120 => array('novemtrigintillion'), 123 => array('quadragintillion'), 126 => array('unquadragintillion'), 129 => array('duoquadragintillion'), 132 => array('trequadragintillion'), 135 => array('quattuorquadragintillion'), 138 => array('quinquadragintillion'), 141 => array('sexquadragintillion'), 144 => array('septenquadragintillion'), 147 => array('octoquadragintillion'), 150 => array('novemquadragintillion'), 153 => array('quinquagintillion'), 156 => array('unquinquagintillion'), 159 => array('duoquinquagintillion'), 162 => array('trequinquagintillion'), 165 => array('quattuorquinquagintillion'), 168 => array('quinquinquagintillion'), 171 => array('sexquinquagintillion'), 174 => array('septenquinquagintillion'), 177 => array('octoquinquagintillion'), 180 => array('novemquinquagintillion'), 183 => array('sexagintillion'), 186 => array('unsexagintillion'), 189 => array('duosexagintillion'), 192 => array('tresexagintillion'), 195 => array('quattuorsexagintillion'), 198 => array('quinsexagintillion'), 201 => array('sexsexagintillion'), 204 => array('septensexagintillion'), 207 => array('octosexagintillion'), 210 => array('novemsexagintillion'), 213 => array('septuagintillion'), 216 => array('unseptuagintillion'), 219 => array('duoseptuagintillion'), 222 => array('treseptuagintillion'), 225 => array('quattuorseptuagintillion'), 228 => array('quinseptuagintillion'), 231 => array('sexseptuagintillion'), 234 => array('septenseptuagintillion'), 237 => array('octoseptuagintillion'), 240 => array('novemseptuagintillion'), 243 => array('octogintillion'), 246 => array('unoctogintillion'), 249 => array('duooctogintillion'), 252 => array('treoctogintillion'), 255 => array('quattuoroctogintillion'), 258 => array('quinoctogintillion'), 261 => array('sexoctogintillion'), 264 => array('septoctogintillion'), 267 => array('octooctogintillion'), 270 => array('novemoctogintillion'), 273 => array('nonagintillion'), 276 => array('unnonagintillion'), 279 => array('duononagintillion'), 282 => array('trenonagintillion'), 285 => array('quattuornonagintillion'), 288 => array('quinnonagintillion'), 291 => array('sexnonagintillion'), 294 => array('septennonagintillion'), 297 => array('octononagintillion'), 300 => array('novemnonagintillion'), 303 => array('centillion'), 309 => array('duocentillion'), 312 => array('trecentillion'), 366 => array('primo-vigesimo-centillion'), 402 => array('trestrigintacentillion'), 603 => array('ducentillion'), 624 => array('septenducentillion'), // bug on a earthlink page: 903 => array('trecentillion'), 2421 => array('sexoctingentillion'), 3003 => array('millillion'), 3000003 => array('milli-millillion') ); /** * The array containing the digits (indexed by the digits themselves). * @var array * @access private */ var $_digits = array( 0 => '×פס', '×××', '×©× ×××', 'ש××ש×', '×ר××¢×', '×××ש×', 'ש×ש×', 'ש××¢×', 'ש××× ×', 'תשע×' ); var $_digits_female = array( 0 => '×פס', '××ת', 'שת×××', 'ש××ש', '×ר××¢', '××ש', 'שש', 'ש××¢', 'ש××× ×', 'תשע' ); var $_digits_ten = array( 2 => 'עשר××', 'ש××ש××', '×ר××¢××', '×××ש××', 'ש×ש××', 'ש××¢××', 'ש××× ××', 'תשע××' ); var $_digits_female = array( 0 => '×פס', '××ת', 'שת×××', 'ש××ש', '×ר××¢', '××ש', 'שש', 'ש××¢', 'ש××× ×', 'תשע' ); var $digits_hundreds = array( 0 => '', '×××', '×©× ×-×××ת', 'ש××ש-×××ת', '×ר××¢-×××ת', '××ש-×××ת', 'שש-×××ת', 'ש××¢-×××ת', 'ש××× ×-×××ת', 'תשע-×××ת' ); /** * The word separator * @var string * @access private */ var $_sep = ' '; var $_sep_hundred = '-'; var $_sep_ten = ' ×'; /** * The currency names (based on the below links, * informations from central bank websites and on encyclopedias) * * @var array * @link http://30-03-67.dreamstation.com/currency_alfa.htm World Currency Information * @link http://www.jhall.demon.co.uk/currency/by_abbrev.html World currencies * @link http://www.shoestring.co.kr/world/p.visa/change.htm Currency names in English * @access private */ var $_currency_names = array( 'ALL' => array(array('lek'), array('qindarka')), 'AUD' => array(array('Australian dollar'), array('cent')), 'BAM' => array(array('convertible marka'), array('fenig')), 'BGN' => array(array('lev'), array('stotinka')), 'BRL' => array(array('real'), array('centavos')), 'BYR' => array(array('Belarussian rouble'), array('kopiejka')), 'CAD' => array(array('Canadian dollar'), array('cent')), 'CHF' => array(array('Swiss franc'), array('rapp')), 'CYP' => array(array('Cypriot pound'), array('cent')), 'CZK' => array(array('Czech koruna'), array('halerz')), 'DKK' => array(array('Danish krone'), array('ore')), 'EEK' => array(array('kroon'), array('senti')), 'EUR' => array(array('euro'), array('euro-cent')), 'GBP' => array(array('pound', 'pounds'), array('pence')), 'HKD' => array(array('Hong Kong dollar'), array('cent')), 'HRK' => array(array('Croatian kuna'), array('lipa')), 'HUF' => array(array('forint'), array('filler')), 'ILS' => array(array('new sheqel','new sheqels'), array('agora','agorot')), 'ISK' => array(array('Icelandic kr�na'), array('aurar')), 'JPY' => array(array('yen'), array('sen')), 'LTL' => array(array('litas'), array('cent')), 'LVL' => array(array('lat'), array('sentim')), 'MKD' => array(array('Macedonian dinar'), array('deni')), 'MTL' => array(array('Maltese lira'), array('centym')), 'NIS' => array(array('שק××× ××ש××'), array('nis')), // need more info if NIS or ILS 'NOK' => array(array('Norwegian krone'), array('oere')), 'PLN' => array(array('zloty', 'zlotys'), array('grosz')), 'ROL' => array(array('Romanian leu'), array('bani')), 'RUB' => array(array('Russian Federation rouble'), array('kopiejka')), 'SEK' => array(array('Swedish krona'), array('oere')), 'SIT' => array(array('Tolar'), array('stotinia')), 'SKK' => array(array('Slovak koruna'), array()), 'TRL' => array(array('lira'), array('kuru�')), 'UAH' => array(array('hryvna'), array('cent')), 'USD' => array(array('dollar'), array('cent')), 'YUM' => array(array('dinars'), array('para')), 'ZAR' => array(array('rand'), array('cent')) ); /** * The default currency name * @var string * @access public */ var $def_currency = 'NIS'; // }}} // {{{ toWords() /** * Converts a number to its word representation * * @param integer $num An integer between -infinity and infinity inclusive :) * that need to be converted to words * @param integer $power The power of ten for the rest of the number to the right. * Optional, defaults to 0. * @param integer $powsuffix The power name to be added to the end of the return string. * Used internally. Optional, defaults to ''. * * @return string The corresponding word representation * * @access public * @author Piotr Klaban <makler@man.torun.pl> * @since PHP 4.2.3 */ function toWords($num, $power = 0, $powsuffix = '') { $ret = ''; // add a minus sign if (substr($num, 0, 1) == '-') { $ret = $this->_sep . $this->_minus; $num = substr($num, 1); } // strip excessive zero signs and spaces $num = trim($num); $num = preg_replace('/^0+/','',$num); if (strlen($num) > 3) { $maxp = strlen($num)-1; $curp = $maxp; for ($p = $maxp; $p > 0; --$p) { // power // check for highest power if (isset($this->_exponent[$p])) { // send substr from $curp to $p $snum = substr($num, $maxp - $curp, $curp - $p + 1); $snum = preg_replace('/^0+/','',$snum); if ($snum !== '') { $cursuffix = $this->_exponent[$power][count($this->_exponent[$power])-1]; if ($powsuffix != '') $cursuffix .= $this->_sep . $powsuffix; $ret .= $this->toWords($snum, $p, $cursuffix); } $curp = $p - 1; continue; } } $num = substr($num, $maxp - $curp, $curp - $p + 1); if ($num == 0) { return $ret; } } elseif ($num == 0 || $num == '') { return $this->_sep . $this->_digits[0]; } $h = $t = $d = 0; switch(strlen($num)) { case 3: $h = (int)substr($num,-3,1); case 2: $t = (int)substr($num,-2,1); case 1: $d = (int)substr($num,-1,1); break; case 0: return; break; } if ($h) { $ret .= $this->_sep . $this->digits_hundreds[$h]; // in English only - add ' and' for [1-9]01..[1-9]99 // (also for 1001..1099, 10001..10099 but it is harder) // for now it is switched off, maybe some language purists // can force me to enable it, or to remove it completely // if (($t + $d) > 0) // $ret .= $this->_sep . 'and'; } // ten, twenty etc. switch ($t) { case 9: case 8: case 7: case 6: case 5: case 4: case 3: case 2: $ret .= $this->_sep . $this->_digits_ten[$t]; break; case 1: switch ($d) { case 0: $ret .= $this->_sep . 'עשר'; break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: $ret .= $this->_sep . $this->_digits[$d] . '-עשר'; break; } break; } if ($t != 1 && $d > 0) { // add digits only in <0>,<1,9> and <21,inf> // add minus sign between [2-9] and digit if ($t > 1) { $ret .= $this -> _sep_ten . $this->_digits[$d]; } else { if (strlen($ret)>0) $ret .= $this->_sep . '×' . $this->_digits[$d]; else $ret .= $this->_sep . $this->_digits[$d]; } } if ($power > 0) { if (isset($this->_exponent[$power])) $lev = $this->_exponent[$power]; if (!isset($lev) || !is_array($lev)) return null; $ret .= $this->_sep . $lev[0]; } if ($powsuffix != '') $ret .= $this->_sep . $powsuffix; return $ret; } // }}} // {{{ toCurrency() /** * Converts a currency value to its word representation * (with monetary units) * * @param integer $int_curr An international currency symbol * as defined by the ISO 4217 standard (three characters) * @param integer $decimal A money total amount without fraction part (e.g. amount of dollars) * @param integer $fraction Fractional part of the money amount (e.g. amount of cents) * Optional. Defaults to false. * * @return string The corresponding word representation for the currency * * @access public * @author Piotr Klaban <makler@man.torun.pl> * @since Numbers_Words 0.4 */ function toCurrencyWords($int_curr, $decimal, $fraction = false) { $int_curr = strtoupper($int_curr); if (!isset($this->_currency_names[$int_curr])) { $int_curr = $this->def_currency; } $curr_names = $this->_currency_names[$int_curr]; $ret = trim($this->toWords($decimal)); $lev = ($decimal == 1) ? 0 : 1; if ($lev > 0) { if (count($curr_names[0]) > 1) { $ret .= $this->_sep . $curr_names[0][$lev]; } else { $ret .= $this->_sep . $curr_names[0][0] . ''; } } else { $ret .= $this->_sep . $curr_names[0][0]; } if ($fraction !== false) { $ret .= $this->_sep . trim($this->toWords($fraction)); $lev = ($fraction == 1) ? 0 : 1; if ($lev > 0) { if (count($curr_names[1]) > 1) { $ret .= $this->_sep . $curr_names[1][$lev]; } else { $ret .= $this->_sep . $curr_names[1][0] . ''; } } else { $ret .= $this->_sep . $curr_names[1][0]; } } return $ret; } // }}} } ?>