Move byte units translations to proper place.
This commit is contained in:
@@ -1375,21 +1375,24 @@ function PMA_profilingResults($profiling_results)
|
|||||||
*/
|
*/
|
||||||
function PMA_formatByteDown($value, $limes = 6, $comma = 0)
|
function PMA_formatByteDown($value, $limes = 6, $comma = 0)
|
||||||
{
|
{
|
||||||
|
/* l10n: shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa+ */
|
||||||
|
$byteUnits = array(__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB'), __('EiB'));
|
||||||
|
|
||||||
$dh = PMA_pow(10, $comma);
|
$dh = PMA_pow(10, $comma);
|
||||||
$li = PMA_pow(10, $limes);
|
$li = PMA_pow(10, $limes);
|
||||||
$return_value = $value;
|
$return_value = $value;
|
||||||
$unit = $GLOBALS['byteUnits'][0];
|
$unit = $byteUnits[0];
|
||||||
|
|
||||||
for ($d = 6, $ex = 15; $d >= 1; $d--, $ex-=3) {
|
for ($d = 6, $ex = 15; $d >= 1; $d--, $ex-=3) {
|
||||||
if (isset($GLOBALS['byteUnits'][$d]) && $value >= $li * PMA_pow(10, $ex)) {
|
if (isset($byteUnits[$d]) && $value >= $li * PMA_pow(10, $ex)) {
|
||||||
// use 1024.0 to avoid integer overflow on 64-bit machines
|
// use 1024.0 to avoid integer overflow on 64-bit machines
|
||||||
$value = round($value / (PMA_pow(1024, $d) / $dh)) /$dh;
|
$value = round($value / (PMA_pow(1024, $d) / $dh)) /$dh;
|
||||||
$unit = $GLOBALS['byteUnits'][$d];
|
$unit = $byteUnits[$d];
|
||||||
break 1;
|
break 1;
|
||||||
} // end if
|
} // end if
|
||||||
} // end for
|
} // end for
|
||||||
|
|
||||||
if ($unit != $GLOBALS['byteUnits'][0]) {
|
if ($unit != $byteUnits[0]) {
|
||||||
// if the unit is not bytes (as represented in current language)
|
// if the unit is not bytes (as represented in current language)
|
||||||
// reformat with max length of 5
|
// reformat with max length of 5
|
||||||
// 4th parameter=true means do not reformat if value < 1
|
// 4th parameter=true means do not reformat if value < 1
|
||||||
|
@@ -21,8 +21,6 @@ $text_dir = __('ltr');
|
|||||||
$number_thousands_separator = __(',');
|
$number_thousands_separator = __(',');
|
||||||
/* l10n: Decimal separator */
|
/* l10n: Decimal separator */
|
||||||
$number_decimal_separator = __('.');
|
$number_decimal_separator = __('.');
|
||||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
|
||||||
$byteUnits = array(__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB'), __('EiB'));
|
|
||||||
|
|
||||||
$strAbortedClients = __('Aborted');
|
$strAbortedClients = __('Aborted');
|
||||||
$strAccessDenied = __('Access denied');
|
$strAccessDenied = __('Access denied');
|
||||||
|
2537
po/be@latin.po
2537
po/be@latin.po
File diff suppressed because it is too large
Load Diff
2999
po/en_GB.po
2999
po/en_GB.po
File diff suppressed because it is too large
Load Diff
2537
po/phpmyadmin.pot
2537
po/phpmyadmin.pot
File diff suppressed because it is too large
Load Diff
2537
po/pt_BR.po
2537
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
2537
po/sr@latin.po
2537
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
2537
po/uz@latin.po
2537
po/uz@latin.po
File diff suppressed because it is too large
Load Diff
2537
po/zh_CN.po
2537
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
2537
po/zh_TW.po
2537
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->tmpGlobals = $GLOBALS;
|
$this->tmpGlobals = $GLOBALS;
|
||||||
$this->tmpSession = $_SESSION;
|
$this->tmpSession = $_SESSION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,10 +107,9 @@ class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public function testFormatByteDown($a, $b, $c, $e) {
|
public function testFormatByteDown($a, $b, $c, $e) {
|
||||||
$GLOBALS['byteUnits'] = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
|
||||||
$GLOBALS['number_thousands_separator'] = ' ';
|
$GLOBALS['number_thousands_separator'] = ' ';
|
||||||
$GLOBALS['number_decimal_separator'] = ',';
|
$GLOBALS['number_decimal_separator'] = ',';
|
||||||
|
|
||||||
|
|
||||||
$result = PMA_formatByteDown($a, $b, $c);
|
$result = PMA_formatByteDown($a, $b, $c);
|
||||||
$result[0] = trim($result[0]);
|
$result[0] = trim($result[0]);
|
||||||
|
Reference in New Issue
Block a user