summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/helpers/number_helper.php13
-rw-r--r--system/language/english/number_lang.php10
2 files changed, 18 insertions, 5 deletions
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index 23ba3a1bb..8c9e384eb 100644
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
@@ -38,30 +38,33 @@ if ( ! function_exists('byte_format'))
{
function byte_format($num)
{
+ $CI =& get_instance();
+ $CI->lang->load('number');
if ($num >= 1000000000000)
{
$num = round($num/1099511627776)/10;
- $unit = 'TB';
+ $unit = $CI->lang->line('terabyte_abbr');
}
elseif ($num >= 1000000000)
{
$num = round($num/107374182)/10;
- $unit = 'GB';
+ $unit = $CI->lang->line('gigabyte_abbr');
}
elseif ($num >= 1000000)
{
$num = round($num/104857)/10;
- $unit = 'MB';
+ $unit = $CI->lang->line('megabyte_abbr');
}
elseif ($num >= 1000)
{
$num = round($num/102)/10;
- $unit = 'KB';
+ $unit = $CI->lang->line('kilobyte_abbr');
}
else
{
- $unit = 'Bytes';
+ $unit = $CI->lang->line('bytes');
+ return number_format($num).' '.$unit;
}
return number_format($num, 1).' '.$unit;
diff --git a/system/language/english/number_lang.php b/system/language/english/number_lang.php
new file mode 100644
index 000000000..f9b91661d
--- /dev/null
+++ b/system/language/english/number_lang.php
@@ -0,0 +1,10 @@
+<?php
+
+$lang['terabyte_abbr'] = "TB";
+$lang['gigabyte_abbr'] = "GB";
+$lang['megabyte_abbr'] = "MB";
+$lang['kilobyte_abbr'] = "KB";
+$lang['bytes'] = "Bytes";
+
+/* End of file number_lang.php */
+/* Location: ./system/language/english/number_lang.php */ \ No newline at end of file