wagnerwagner / merx

Merx is a plugin to create online shops with Kirby.
https://merx.wagnerwagner.de
102 stars 10 forks source link

Some locale related options do not seem to work #10

Closed plagasul closed 3 years ago

plagasul commented 4 years ago

I have the following options set:

/* Decimal and thousands separator for MERX*/
'ww.merx.currencyDecimalPoint' => ',',
'ww.merx.currencyThousandsSeparator' => '.',
'ww.merx.currencyPositionPrecedes' => false,

/* Currency for MERX */
'ww.merx.currency' => 'EUR',
'ww.merx.currencySymbol' => '€',

But this does not seem to work, for example the following:

<?= formatPrice(15.23)?>

Returns 15.23 €, and localeconv() returns:

Array
(
    [decimal_point] => .
    [thousands_sep] => 
    [int_curr_symbol] => 
    [currency_symbol] => 
    [mon_decimal_point] => 
    [mon_thousands_sep] => 
    [positive_sign] => 
    [negative_sign] => 
    [int_frac_digits] => 127
    [frac_digits] => 127
    [p_cs_precedes] => 127
    [p_sep_by_space] => 127
    [n_cs_precedes] => 127
    [n_sep_by_space] => 127
    [p_sign_posn] => 127
    [n_sign_posn] => 127
    [grouping] => Array
        (
        )

    [mon_grouping] => Array
        (
        )

)

If I set Kirby's locale instead to something like:

'locale' => [
    LC_ALL      => 'es_ES.utf8',
],

Then the output of <?= formatPrice(15.23)?> is 15,23 € , and localeconv() returns:

Array
(
    [decimal_point] => ,
    [thousands_sep] => .
    [int_curr_symbol] => EUR 
    [currency_symbol] => €
    [mon_decimal_point] => ,
    [mon_thousands_sep] => .
    [positive_sign] => 
    [negative_sign] => -
    [int_frac_digits] => 2
    [frac_digits] => 2
    [p_cs_precedes] => 0
    [p_sep_by_space] => 1
    [n_cs_precedes] => 0
    [n_sep_by_space] => 1
    [p_sign_posn] => 1
    [n_sign_posn] => 1
    [grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

    [mon_grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

)

...so either I am not providing the options correctly or the options are not working ?

Thank you

tobiasfabian commented 4 years ago

Hey @plagasul,

I'm afraid I can't reproduce your problem. Are you sure ww.merx.currencyDecimalPoint is set correctly, you can try to dump this option to double check.

dump(option('ww.merx.currencyDecimalPoint')); // should output ','
tobiasfabian commented 3 years ago

@plagasul I close this issue. Let me know if the problem persists.