Commit 7afa64f6 by pupi1985

Added qa_format_number function to replace all number_format

parent d3860445
...@@ -2043,6 +2043,24 @@ ...@@ -2043,6 +2043,24 @@
); );
} }
/**
* Format a number using the decimal point and thousand separator specified in the language files
* @param integer $number Number to be formatted
* @param integer $decimals Amount of decimals to use
* @return string The formatted number as a string
*/
function qa_format_number($number, $decimals = 0)
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
return number_format(
$number,
$decimals,
qa_lang_html('main/_decimal_point'),
qa_lang_html('main/_thousands_separator')
);
}
/* /*
Omit PHP closing tag to help avoid accidental output Omit PHP closing tag to help avoid accidental output
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
*/ */
return array( return array(
'_decimal_point' => '.',
'_thousands_separator' => ',',
'1_answer' => '1 answer', '1_answer' => '1 answer',
'1_comment' => '1 comment', '1_comment' => '1 comment',
'1_day' => '1 day', '1_day' => '1 day',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment