506 lines
16 KiB
PHP
506 lines
16 KiB
PHP
|
<?php
|
|||
|
/* vim: set expandtab tabstop=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 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: Kouber Saparev <kouber@php.net> |
|
|||
|
// +----------------------------------------------------------------------+
|
|||
|
//
|
|||
|
// $Id: lang.bg.php,v 1.4 2004/10/22 18:22:52 kouber Exp $
|
|||
|
|
|||
|
/**
|
|||
|
* Include needed files
|
|||
|
*/
|
|||
|
require_once("Numbers/Words.php");
|
|||
|
|
|||
|
/**
|
|||
|
* Class for translating numbers into Bulgarian.
|
|||
|
*
|
|||
|
* @author Kouber Saparev <kouber@php.net>
|
|||
|
* @package Numbers_Words
|
|||
|
*/
|
|||
|
class Numbers_Words_bg extends Numbers_Words
|
|||
|
{
|
|||
|
|
|||
|
// {{{ properties
|
|||
|
|
|||
|
/**
|
|||
|
* Locale name.
|
|||
|
* @var string
|
|||
|
* @access public
|
|||
|
*/
|
|||
|
var $locale = 'bg';
|
|||
|
|
|||
|
/**
|
|||
|
* Language name in English.
|
|||
|
* @var string
|
|||
|
* @access public
|
|||
|
*/
|
|||
|
var $lang = 'Bulgarian';
|
|||
|
|
|||
|
/**
|
|||
|
* Native language name.
|
|||
|
* @var string
|
|||
|
* @access public
|
|||
|
*/
|
|||
|
var $lang_native = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
/**
|
|||
|
* Some miscellaneous words and language constructs.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_misc_strings = array(
|
|||
|
'deset'=>'<27><><EFBFBD><EFBFBD><EFBFBD>', // "ten"
|
|||
|
'edinadeset'=>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', // "eleven"
|
|||
|
'na'=>'<27><>', // liaison particle for 12 to 19
|
|||
|
'sto'=>'<27><><EFBFBD>', // "hundred"
|
|||
|
'sta'=>'<27><><EFBFBD>', // suffix for 2 and 3 hundred
|
|||
|
'stotin'=>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', // suffix for 4 to 9 hundred
|
|||
|
'hiliadi'=>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' // plural form of "thousand"
|
|||
|
);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* The words for digits (except zero). Note that, there are three genders for them (neuter, masculine and feminine).
|
|||
|
* The words for 3 to 9 (masculine) and for 2 to 9 (feminine) are the same as neuter, so they're filled
|
|||
|
* in the _initDigits() method, which is invoked from the constructor.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_digits = array(
|
|||
|
0=>array(1=>"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), // neuter
|
|||
|
1=>array(1=>'<27><><EFBFBD><EFBFBD>', '<27><><EFBFBD>'), // masculine
|
|||
|
-1=>array(1=>'<27><><EFBFBD><EFBFBD>') // feminine
|
|||
|
);
|
|||
|
|
|||
|
/**
|
|||
|
* A flag, that determines if the _digits array is filled for masculine and feminine genders.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_digits_initialized = false;
|
|||
|
|
|||
|
/**
|
|||
|
* A flag, that determines if the "and" word is placed already before the last non-empty group of digits.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_last_and = false;
|
|||
|
|
|||
|
/**
|
|||
|
* The word for zero.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_zero = '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
/**
|
|||
|
* The word for infinity.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_infinity = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
/**
|
|||
|
* The word for the "and" language construct.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_and = '<27>';
|
|||
|
|
|||
|
/**
|
|||
|
* The word separator.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_sep = ' ';
|
|||
|
|
|||
|
/**
|
|||
|
* The word for the minus sign.
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_minus = '<27><><EFBFBD><EFBFBD><EFBFBD>'; // minus sign
|
|||
|
|
|||
|
/**
|
|||
|
* The plural suffix (except for thousand).
|
|||
|
* @var string
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_plural = '<27>'; // plural suffix
|
|||
|
|
|||
|
/**
|
|||
|
* The suffixes for exponents (singular).
|
|||
|
* @var array
|
|||
|
* @access private
|
|||
|
*/
|
|||
|
var $_exponent = array(
|
|||
|
0 => '',
|
|||
|
3 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
6 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
9 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
12 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
15 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
18 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
21 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
24 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
27 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
30 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
33 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
36 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
39 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
42 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
45 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
48 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
51 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
54 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
57 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
60 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
63 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
66 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
69 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
72 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
75 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
78 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
81 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
84 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
87 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
90 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
93 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
96 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
99 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
102 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
105 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
108 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
111 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
114 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
117 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
120 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
123 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
126 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
129 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
132 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
135 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
138 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
141 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
144 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
147 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
150 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
153 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
156 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
159 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
162 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
165 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
168 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
171 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
174 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
177 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
180 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
183 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
186 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
189 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
192 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
195 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
198 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
201 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
204 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
207 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
210 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
213 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
216 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
219 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
222 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
225 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
228 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
231 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
234 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
237 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
240 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
243 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
246 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
249 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
252 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
255 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
258 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
261 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
264 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
267 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
270 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
273 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
276 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
279 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
282 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
285 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
288 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
291 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
294 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
297 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
300 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
303 => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|||
|
);
|
|||
|
// }}}
|
|||
|
|
|||
|
// {{{ Numbers_Words_bg()
|
|||
|
|
|||
|
/**
|
|||
|
* The class constructor, used for calling the _initDigits method.
|
|||
|
*
|
|||
|
* @return void
|
|||
|
*
|
|||
|
* @access public
|
|||
|
* @author Kouber Saparev <kouber@php.net>
|
|||
|
* @see function _initDigits
|
|||
|
*/
|
|||
|
function __construct() {
|
|||
|
$this->_initDigits();
|
|||
|
}
|
|||
|
// }}}
|
|||
|
|
|||
|
// {{{ _initDigits()
|
|||
|
|
|||
|
/**
|
|||
|
* Fills the _digits array for masculine and feminine genders with
|
|||
|
* corresponding references to neuter words (when they're the same).
|
|||
|
*
|
|||
|
* @return void
|
|||
|
*
|
|||
|
* @access private
|
|||
|
* @author Kouber Saparev <kouber@php.net>
|
|||
|
*/
|
|||
|
function _initDigits() {
|
|||
|
if (!$this->_digits_initialized) {
|
|||
|
for ($i=3; $i<=9; $i++) {
|
|||
|
$this->_digits[1][$i] = $this->_digits[0][$i];
|
|||
|
}
|
|||
|
for ($i=2; $i<=9; $i++) {
|
|||
|
$this->_digits[-1][$i] = $this->_digits[0][$i];
|
|||
|
}
|
|||
|
$this->_digits_initialized = true;
|
|||
|
}
|
|||
|
}
|
|||
|
// }}}
|
|||
|
|
|||
|
// {{{ _splitNumber()
|
|||
|
|
|||
|
/**
|
|||
|
* Split a number to groups of three-digit numbers.
|
|||
|
*
|
|||
|
* @param mixed $num An integer or its string representation
|
|||
|
* that need to be split
|
|||
|
*
|
|||
|
* @return array Groups of three-digit numbers.
|
|||
|
*
|
|||
|
* @access private
|
|||
|
* @author Kouber Saparev <kouber@php.net>
|
|||
|
* @since PHP 4.2.3
|
|||
|
*/
|
|||
|
|
|||
|
function _splitNumber($num)
|
|||
|
{
|
|||
|
if (is_string($num)) {
|
|||
|
$ret = array();
|
|||
|
$strlen = strlen($num);
|
|||
|
$first = substr($num, 0, $strlen%3);
|
|||
|
preg_match_all('/\d{3}/', substr($num, $strlen%3, $strlen), $m);
|
|||
|
$ret = $m[0];
|
|||
|
if ($first) array_unshift($ret, $first);
|
|||
|
return $ret;
|
|||
|
}
|
|||
|
else
|
|||
|
return explode(' ', number_format($num, 0, '', ' ')); // a faster version for integers
|
|||
|
}
|
|||
|
// }}}
|
|||
|
|
|||
|
// {{{ _showDigitsGroup()
|
|||
|
|
|||
|
/**
|
|||
|
* Converts a three-digit number to its word representation
|
|||
|
* in Bulgarian language.
|
|||
|
*
|
|||
|
* @param integer $num An integer between 1 and 999 inclusive.
|
|||
|
*
|
|||
|
* @param integer $gender An integer which represents the gender of
|
|||
|
* the current digits group.
|
|||
|
* 0 - neuter
|
|||
|
* 1 - masculine
|
|||
|
* -1 - feminine
|
|||
|
*
|
|||
|
* @param boolean $last A flag that determines if the current digits group
|
|||
|
* is the last one.
|
|||
|
*
|
|||
|
* @return string The words for the given number.
|
|||
|
*
|
|||
|
* @access private
|
|||
|
* @author Kouber Saparev <kouber@php.net>
|
|||
|
*/
|
|||
|
function _showDigitsGroup($num, $gender = 0, $last = false)
|
|||
|
{
|
|||
|
/* A storage array for the return string.
|
|||
|
Positions 1, 3, 5 are intended for digit words
|
|||
|
and everything else (0, 2, 4) for "and" words.
|
|||
|
Both of the above types are optional, so the size of
|
|||
|
the array may vary.
|
|||
|
*/
|
|||
|
$ret = array();
|
|||
|
|
|||
|
// extract the value of each digit from the three-digit number
|
|||
|
$e = $num%10; // ones
|
|||
|
$d = ($num-$e)%100/10; // tens
|
|||
|
$s = ($num-$d*10-$e)%1000/100; // hundreds
|
|||
|
|
|||
|
// process the "hundreds" digit.
|
|||
|
if ($s) {
|
|||
|
switch ($s) {
|
|||
|
case 1:
|
|||
|
$ret[1] = $this->_misc_strings['sto'];
|
|||
|
break;
|
|||
|
case 2:
|
|||
|
case 3:
|
|||
|
$ret[1] = $this->_digits[0][$s].$this->_misc_strings['sta'];
|
|||
|
break;
|
|||
|
default:
|
|||
|
$ret[1] = $this->_digits[0][$s].$this->_misc_strings['stotin'];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// process the "tens" digit, and optionally the "ones" digit.
|
|||
|
if ($d) {
|
|||
|
// in the case of 1, the "ones" digit also must be processed
|
|||
|
if ($d==1) {
|
|||
|
if (!$e) {
|
|||
|
$ret[3] = $this->_misc_strings['deset']; // ten
|
|||
|
} else {
|
|||
|
if ($e==1) {
|
|||
|
$ret[3] = $this->_misc_strings['edinadeset']; // eleven
|
|||
|
} else {
|
|||
|
$ret[3] = $this->_digits[1][$e].$this->_misc_strings['na'].$this->_misc_strings['deset']; // twelve - nineteen
|
|||
|
}
|
|||
|
// the "ones" digit is alredy processed, so skip a second processment
|
|||
|
$e = 0;
|
|||
|
}
|
|||
|
} else {
|
|||
|
$ret[3] = $this->_digits[1][$d].$this->_misc_strings['deset']; // twenty - ninety
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// process the "ones" digit
|
|||
|
if ($e) {
|
|||
|
$ret[5] = $this->_digits[$gender][$e];
|
|||
|
}
|
|||
|
|
|||
|
// put "and" where needed
|
|||
|
if (count($ret)>1) {
|
|||
|
if ($e) {
|
|||
|
$ret[4] = $this->_and;
|
|||
|
} else {
|
|||
|
$ret[2] = $this->_and;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// put "and" optionally in the case this is the last non-empty group
|
|||
|
if ($last) {
|
|||
|
if (!$s||count($ret)==1) {
|
|||
|
$ret[0] = $this->_and;
|
|||
|
}
|
|||
|
$this->_last_and = true;
|
|||
|
}
|
|||
|
|
|||
|
// sort the return array so that "and" constructs go to theirs appropriate places
|
|||
|
ksort($ret);
|
|||
|
|
|||
|
return implode($this->_sep, $ret);
|
|||
|
}
|
|||
|
// }}}
|
|||
|
|
|||
|
// {{{ toWords()
|
|||
|
|
|||
|
/**
|
|||
|
* Converts a number to its word representation
|
|||
|
* in Bulgarian language.
|
|||
|
*
|
|||
|
* @param integer $num An integer between 9.99*-10^302 and 9.99*10^302 (999 centillions)
|
|||
|
* that need to be converted to words
|
|||
|
*
|
|||
|
* @return string The corresponding word representation
|
|||
|
*
|
|||
|
* @access public
|
|||
|
* @author Kouber Saparev <kouber@php.net>
|
|||
|
*/
|
|||
|
function toWords($num = 0)
|
|||
|
{
|
|||
|
$ret = array();
|
|||
|
$ret_minus = '';
|
|||
|
|
|||
|
// check if $num is a valid non-zero number
|
|||
|
if (!$num || preg_match('/^-?0+$/', $num) || !preg_match('/^-?\d+$/', $num)) return $this->_zero;
|
|||
|
|
|||
|
// add a minus sign
|
|||
|
if (substr($num, 0, 1) == '-') {
|
|||
|
$ret_minus = $this->_minus . $this->_sep;
|
|||
|
$num = substr($num, 1);
|
|||
|
}
|
|||
|
|
|||
|
// if the absolute value is greater than 9.99*10^302, return infinity
|
|||
|
if (strlen($num)>306) {
|
|||
|
return $ret_minus . $this->_infinity;
|
|||
|
}
|
|||
|
|
|||
|
// strip excessive zero signs
|
|||
|
$num = ltrim($num, '0');
|
|||
|
|
|||
|
// split $num to groups of three-digit numbers
|
|||
|
$num_groups = $this->_splitNumber($num);
|
|||
|
|
|||
|
$sizeof_numgroups = count($num_groups);
|
|||
|
|
|||
|
// go through the groups in reverse order, so that the last group could be determined
|
|||
|
for ($i=$sizeof_numgroups-1, $j=1; $i>=0; $i--, $j++) {
|
|||
|
if (!isset($ret[$j])) {
|
|||
|
$ret[$j] = '';
|
|||
|
}
|
|||
|
|
|||
|
// what is the corresponding exponent for the current group
|
|||
|
$pow = $sizeof_numgroups-$i;
|
|||
|
|
|||
|
// skip processment for empty groups
|
|||
|
if ($num_groups[$i]!='000') {
|
|||
|
if ($num_groups[$i]>1) {
|
|||
|
if ($pow==1) {
|
|||
|
$ret[$j] .= $this->_showDigitsGroup($num_groups[$i], 0, !$this->_last_and && $i).$this->_sep;
|
|||
|
$ret[$j] .= $this->_exponent[($pow-1)*3];
|
|||
|
} elseif ($pow==2) {
|
|||
|
$ret[$j] .= $this->_showDigitsGroup($num_groups[$i], -1, !$this->_last_and && $i).$this->_sep;
|
|||
|
$ret[$j] .= $this->_misc_strings['hiliadi'].$this->_sep;
|
|||
|
} else {
|
|||
|
$ret[$j] .= $this->_showDigitsGroup($num_groups[$i], 1, !$this->_last_and && $i).$this->_sep;
|
|||
|
$ret[$j] .= $this->_exponent[($pow-1)*3].$this->_plural.$this->_sep;
|
|||
|
}
|
|||
|
} else {
|
|||
|
if ($pow==1) {
|
|||
|
$ret[$j] .= $this->_showDigitsGroup($num_groups[$i], 0, !$this->_last_and && $i).$this->_sep;
|
|||
|
} elseif ($pow==2) {
|
|||
|
$ret[$j] .= $this->_exponent[($pow-1)*3].$this->_sep;
|
|||
|
} else {
|
|||
|
$ret[$j] .= $this->_digits[1][1].$this->_sep.$this->_exponent[($pow-1)*3].$this->_sep;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return $ret_minus . rtrim(implode('', array_reverse($ret)), $this->_sep);
|
|||
|
}
|
|||
|
// }}}
|
|||
|
}
|
|||
|
?>
|