/usr/share/php/Numbers/Words/Locale/de.php is in php-numbers-words 0.18.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | <?php
/**
* Numbers_Words
*
* PHP version 5
*
* Copyright (c) 1997-2006 The PHP Group
*
* This source file is subject to version 3.01 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_01.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.
*
* @category Numbers
* @package Numbers_Words
* @author Piotr Klaban <makler@man.torun.pl>
* @license PHP 3.01 http://www.php.net/license/3_01.txt
* @version SVN: $Id$
* @link http://pear.php.net/package/Numbers_Words
*/
/**
*
* Class for translating numbers into German.
* @author Piotr Klaban
* @package Numbers_Words
*/
/**
* Include needed files
*/
require_once "Numbers/Words.php";
/**
* Class for translating numbers into German.
*
* @category Numbers
* @package Numbers_Words
* @author Piotr Klaban <makler@man.torun.pl>
* @license PHP 3.01 http://www.php.net/license/3_01.txt
* @link http://pear.php.net/package/Numbers_Words
*/
class Numbers_Words_Locale_de extends Numbers_Words
{
// {{{ properties
/**
* Locale name
* @var string
* @access public
*/
var $locale = 'de';
/**
* Language name in English
* @var string
* @access public
*/
var $lang = 'German';
/**
* Native language name
* @var string
* @access public
*/
var $lang_native = 'Deutsch';
/**
* 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://german.about.com/library/blzahlenaud.htm
* http://www3.osk.3web.ne.jp/~nagatani/common/zahlwort.htm
* @var array
* @access private
*/
var $_exponent = array(
0 => array(''),
3 => array('tausend','tausend'),
6 => array('Million','Millionen'),
9 => array('Milliarde','Milliarden'),
12 => array('Billion','Billionen'),
15 => array('Billiarde','Billiarden'),
18 => array('Trillion','Trillionen'),
21 => array('Trilliarde','Trilliarden'),
24 => array('Quadrillion','Quadrillionen'),
27 => array('Quadrilliarde','Quadrilliarden'),
30 => array('Quintillion','Quintillionen'),
33 => array('Quintilliarde','Quintilliarden'),
36 => array('Sextillion','Sextillionen'),
39 => array('Sextilliarde','Sextilliarden'),
42 => array('Septillion','Septillionen'),
45 => array('Septilliarde','Septilliarden'),
48 => array('Oktillion','Oktillionen'), // oder Octillionen
51 => array('Oktilliarde','Oktilliarden'),
54 => array('Nonillion','Nonillionen'),
57 => array('Nonilliarde','Nonilliarden'),
60 => array('Dezillion','Dezillionen'),
63 => array('Dezilliarde','Dezilliarden'),
120 => array('Vigintillion','Vigintillionen'),
123 => array('Vigintilliarde','Vigintilliarden'),
600 => array('Zentillion','Zentillionen'), // oder Centillion
603 => array('Zentilliarde','Zentilliarden')
);
/**
* The array containing the digits (indexed by the digits themselves).
* @var array
* @access private
*/
var $_digits = array(
0 => 'null', 'ein', 'zwei', 'drei', 'vier',
'fünf', 'sechs', 'sieben', 'acht', 'neun'
);
/**
* The word separator
* @var string
* @access private
*/
var $_sep = '';
/**
* The exponent word separator
* @var string
* @access private
*/
var $_sep2 = ' ';
// }}}
// {{{ _toWords()
/**
* Converts a number to its word representation
* in German 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 protected
* @author Piotr Klaban <makler@man.torun.pl>
* @since Numbers_Words 0.16.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[$h] . $this->_sep . 'hundert';
}
if ($t != 1 && $d > 0) { // add digits only in <0>,<1,9> and <21,inf>
if ($t > 0) {
$ret .= $this->_digits[$d] . 'und';
} else {
$ret .= $this->_digits[$d];
if ($d == 1) {
if ($power == 0) {
$ret .= 's'; // fuer eins
} else {
if ($power != 3) { // tausend ausnehmen
$ret .= 'e'; // fuer eine
}
}
}
}
}
// ten, twenty etc.
switch ($t) {
case 9:
case 8:
case 5:
$ret .= $this->_sep . $this->_digits[$t] . 'zig';
break;
case 7:
$ret .= $this->_sep . 'siebzig';
break;
case 6:
$ret .= $this->_sep . 'sechzig';
break;
case 4:
$ret .= $this->_sep . 'vierzig';
break;
case 3:
$ret .= $this->_sep . 'dreißig';
break;
case 2:
$ret .= $this->_sep . 'zwanzig';
break;
case 1:
switch ($d) {
case 0:
$ret .= $this->_sep . 'zehn';
break;
case 1:
$ret .= $this->_sep . 'elf';
break;
case 2:
$ret .= $this->_sep . 'zwölf';
break;
case 3:
case 4:
case 5:
case 8:
case 9:
$ret .= $this->_sep . $this->_digits[$d] . 'zehn';
break;
case 6:
$ret .= $this->_sep . 'sechzehn';
break;
case 7:
$ret .= $this->_sep . 'siebzehn';
break;
}
break;
}
if ($power > 0) {
if (isset($this->_exponent[$power])) {
$lev = $this->_exponent[$power];
}
if (!isset($lev) || !is_array($lev)) {
return null;
}
if ($power == 3) {
$ret .= $this->_sep . $lev[0];
} elseif ($d == 1 && ($t+$h) == 0) {
$ret .= $this->_sep2 . $lev[0] . $this->_sep2;
} else {
$ret .= $this->_sep2 . $lev[1] . $this->_sep2;
}
}
if ($powsuffix != '') {
$ret .= $this->_sep . $powsuffix;
}
return $ret;
}
// }}}
}
|