Migrate separator code to gettext.
This commit is contained in:
@@ -1405,6 +1405,22 @@ function PMA_formatByteDown($value, $limes = 6, $comma = 0)
|
||||
return array(trim($return_value), $unit);
|
||||
} // end of the 'PMA_formatByteDown' function
|
||||
|
||||
/**
|
||||
* Changes thousands and decimal separators to locale specific values.
|
||||
*/
|
||||
function PMA_localizeNumber($value)
|
||||
{
|
||||
return str_replace(
|
||||
array(',', '.'),
|
||||
array(
|
||||
/* l10n: Thousands separator */
|
||||
__(','),
|
||||
/* l10n: Decimal separator */
|
||||
__('.'),
|
||||
),
|
||||
$value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats $value to the given length and appends SI prefixes
|
||||
* $comma is not substracted from the length
|
||||
@@ -1436,9 +1452,7 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false)
|
||||
{
|
||||
//number_format is not multibyte safe, str_replace is safe
|
||||
if ($length === 0) {
|
||||
return str_replace(array(',', '.'),
|
||||
array($GLOBALS['number_thousands_separator'], $GLOBALS['number_decimal_separator']),
|
||||
number_format($value, $comma));
|
||||
return PMA_localizeNumber(number_format($value, $comma));
|
||||
}
|
||||
|
||||
// this units needs no translation, ISO
|
||||
@@ -1499,9 +1513,7 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false)
|
||||
} // end if ($value >= 1) elseif (!$only_down && (float) $value !== 0.0)
|
||||
|
||||
//number_format is not multibyte safe, str_replace is safe
|
||||
$value = str_replace(array(',', '.'),
|
||||
array($GLOBALS['number_thousands_separator'], $GLOBALS['number_decimal_separator']),
|
||||
number_format($value, $comma));
|
||||
$value = PMA_localizeNumber(number_format($value, $comma));
|
||||
|
||||
return $sign . $value . ' ' . $unit;
|
||||
} // end of the 'PMA_formatNumber' function
|
||||
|
@@ -17,10 +17,6 @@ $charset = 'utf-8';
|
||||
|
||||
/* l10n: Text direction, use either ltr or rtl */
|
||||
$text_dir = __('ltr');
|
||||
/* l10n: Thousands separator */
|
||||
$number_thousands_separator = __(',');
|
||||
/* l10n: Decimal separator */
|
||||
$number_decimal_separator = __('.');
|
||||
|
||||
$strAbortedClients = __('Aborted');
|
||||
$strAccessDenied = __('Access denied');
|
||||
|
2500
po/be@latin.po
2500
po/be@latin.po
File diff suppressed because it is too large
Load Diff
2690
po/en_GB.po
2690
po/en_GB.po
File diff suppressed because it is too large
Load Diff
2500
po/phpmyadmin.pot
2500
po/phpmyadmin.pot
File diff suppressed because it is too large
Load Diff
2500
po/pt_BR.po
2500
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
2500
po/sr@latin.po
2500
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
2500
po/uz@latin.po
2500
po/uz@latin.po
File diff suppressed because it is too large
Load Diff
2500
po/zh_CN.po
2500
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
2500
po/zh_TW.po
2500
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -79,9 +79,6 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
|
||||
public function testFormatNumber($a, $b, $c, $e) {
|
||||
$GLOBALS['number_thousands_separator'] = ' ';
|
||||
$GLOBALS['number_decimal_separator'] = ',';
|
||||
|
||||
$this->assertEquals($e, (string)PMA_formatNumber($a, $b, $c, false));
|
||||
}
|
||||
|
||||
@@ -107,10 +104,6 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
|
||||
public function testFormatByteDown($a, $b, $c, $e) {
|
||||
$GLOBALS['number_thousands_separator'] = ' ';
|
||||
$GLOBALS['number_decimal_separator'] = ',';
|
||||
|
||||
|
||||
$result = PMA_formatByteDown($a, $b, $c);
|
||||
$result[0] = trim($result[0]);
|
||||
$this->assertEquals($e, $result);
|
||||
|
Reference in New Issue
Block a user