Open extra topbar

Currency symbols and localization

If you are new here, please see some information on how to ask for support. Thank you!

Currency symbols and localization

dashed-slug.net Forums General discussion Currency symbols and localization

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5410
    tfontoura
    Participant

    Using USD we have the dollar sign before the amount, how to do the same for another currency, how to display “R$ 0.00” instead of “BRL 0.00”?
    Still talking about localization, in some countries we use the comma “,” as decimals separator and the period “.” as the thousands separator, i.e. “1.000,00” for one thousand, instead of “1,000.00” as in the US. Is there a way to change separators? Maybe for some currencies only?
    Thanks a lot for all your hard work!

    #5412
    tfontoura
    Participant

    It seems the following wp function found at https://codex.wordpress.org/Function_Reference/number_format_i18n would do the European formatting trick:
    <?php number_format_i18n( $number, $decimals ); ?>
    But I’m not sure where I can use it so it is not overwritten by wallet updates.

    #5413
    tfontoura
    Participant

    Solved the symbol issue by utilizing filters as per PDF page 30. Still have to find out how to change to the European format.

    #5422
    alexg
    Keymaster

    Hello,

    Thank you. You bring a valid point.

    As you found out, you can modify the symbol using the filter under “Frontend -> JSON API filters -> Amounts pattern” in the manual. This is an sprintf pattern that is used both on the server side and client side to format patterns.

    It is not possible to use this pattern to set the decimals separator and thousands separator.

    Ultimately this is not something that you should have to do. I will have to investigate how to make the plugin respect the regional settings of the current locale. This is likely not going to be easy, as many things need to change throughout the plugin.

    I will report any progress on this thread.

    with regards

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.