| Locale | strcoll('ñ','n') strcoll('ñ','o') |
strtoupper() | money_format() | number_format() localeconv() |
strftime() | nl_langinfo() días de la semana |
nl_langinfo() meses |
|---|---|---|---|---|---|---|---|
| es_ES | 1 -1 | ÁÉÍÓÚÑÜ | EUR 123.456,79 | EUR123456,79 | 10/02/12 10:09:43 | domingo lunes martes miércoles jueves viernes sábado | enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre |
| en_US | 8 -1 | ÁÉÍÓÚÑÜ | USD 123,456.79 | $123,456.79 | 02/10/2012 10:09:43 AM | Sunday Monday Tuesday Wednesday Thursday Friday Saturday | January February March April May June July August September October November December |
<?php
function linea($locale) {
if ( setlocale(LC_ALL,$locale) != $locale) return;
$loc =localeconv();
echo '<tr><td>',$locale
,'</td><td>',strcoll('ñ','n'),'<br />',strcoll('ñ','o')
,'</td><td>', strtoupper('áéíóúñü')
,'</td><td>',money_format('%i', 123456.789)
, '</td><td>',$loc['currency_symbol'] , number_format(123456.789,$loc['frac_digits'],$loc['decimal_point'],$loc['thousands_sep'])
, '</td><td>',strftime('%x %X')
, '</td><td>';
for ($i=1;$i<=7;$i++) echo nl_langinfo(constant('DAY_'.$i)),'<br/>';
echo '</td><td>';
for ($i=1;$i<=12;$i++) echo nl_langinfo(constant('MON_'.$i)),'<br/>';
echo '</td></tr>';
}
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Aplicaciones de la función setlocale()</title>
</head>
<body>
<h1>Aplicaciones de la función setlocale()</h1>
<form method="get" action="index.php">
<p>Indique otro locale: <input type="text" name="locale" /> <input type="submit" name="submit" value="Aceptar" /></p>
</form>
<p align="right"><a href="../index.html">Volver</a></p>
<table border="1"><tr>
<th>Locale</th>
<th>strcoll('ñ','n')<br />strcoll('ñ','o')</th>
<th>strtoupper()</th>
<th>money_format()</th>
<th>number_format()<br/>localeconv()</th>
<th>strftime()</th>
<th>nl_langinfo()<br/>días de la semana</th>
<th>nl_langinfo()<br/>meses</th>
</tr>
<?php
$locale = $_GET['locale'];
if (!is_null($locale)) linea($locale);
linea('es_ES');
linea('es_MX');
linea('en_GB');
linea('en_US');
linea('nl_NL');
linea('ca_ES');
linea('pt_BR');
linea('pt_PT');
linea('ja_JP');
linea('el_GR');
?>
</table>
<h3>Este archivo</h3>
<pre><?php highlight_file('index.php'); ?> </pre>
</body></html>