mohanjith / web-invoice

Automatically exported from code.google.com/p/web-invoice
GNU General Public License v3.0
0 stars 2 forks source link

Allow the user to change date or number formatting #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Allow the user to change the formatting of dates and numbers, for example in 
some countries it is not necessary to use cents, therefore instead of showing: 
$500,000.00, it should show just $500,000

Or change the thousand / decimal symbol, some countries use "," for decimals 
and viceversa.

Original issue reported on code.google.com by juansalc...@gmail.com on 23 Sep 2010 at 9:25

GoogleCodeExporter commented 9 years ago
These are part of the locale. Set the proper locale in wp-config.php. 
http://codex.wordpress.org/Installing_WordPress_in_Your_Language

Original comment by sh.mohanjith on 25 Sep 2010 at 3:06

GoogleCodeExporter commented 9 years ago
Thanks for checking this Moha, however I tried different locale settings for:
 define ('WPLANG', '...');

And none changed the actual formatting of dates and numbers, so I recommend 
checking this again.

Cheers.

Original comment by juansalc...@gmail.com on 27 Sep 2010 at 9:56

GoogleCodeExporter commented 9 years ago
Also, I found this in Functions.php:499

function web_invoice_currency_format($amount) {
    return number_format($amount, 2, __('.', WEB_INVOICE_TRANS_DOMAIN), __(',', WEB_INVOICE_TRANS_DOMAIN));
}

And these in Display.php:2143 & 2164

    if(!strpos($amount,'.')) $amount = $amount . ".00";

    if(!strpos($itemized_item[price],'.')) $itemized_item[price] = $itemized_item[price] . ".00";

This shows that the decimal notation is not being set by the environment locale 
setting.

Also, the problem of leaving this to the "define ('WPLANG', '...')" setting in 
wp-config.php is that some countries don't have specific translations for their 
country (so it depends on the generic main country translation --e.g. es-ES--), 
and this country may have different formatting needs. (e.g. es-CO --no 
decimals--).

I also found that there are specific "translation strings" for the date 
formatting and for the thousands and decimal separators.

Original comment by juansalc...@gmail.com on 27 Sep 2010 at 11:44