Prestashop: Changing number format or other settings in XML localizations specific to a region doesn't work

Created on 7 Jan 2020  路  8Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
I needed to change the way price format was handled for Switzerland in Prestashop 1.7.6.2. I found the XML files into \localization\CLDR\core\common\main. I edited the file fr_CH.xml, adding this modified version of the <number> entity:

<numbers>
    <symbols numberSystem="latn">
        <decimal>.</decimal>
        <group>'</group>
    </symbols>
    <percentFormats numberSystem="latn">
        <percentFormatLength>
            <percentFormat>
                <pattern draft="contributed">#,##0%</pattern>
            </percentFormat>
        </percentFormatLength>
    </percentFormats>
    <currencyFormats numberSystem="latn">
        <currencyFormatLength>
            <currencyFormat type="standard">
                <pattern draft="contributed">陇聽#,##0.00;陇 -#,##0.00</pattern>
            </currencyFormat>
        </currencyFormatLength>
    </currencyFormats>
</numbers>

It didn't work. But when I changed these settings in the fr.xml file, it worked.

In my Localization settings in Prestashop, I do have this:

Screenshot_1

I tried changing the settings to fr_BE everywhere, changing the fr_BE.xml file, to see if the issue was specific to the fr_CH file.

Every time I changed the XML files, I emptied the Prestashop cache and my browser cache.

Result

Editing a regional file (fr_CH.xml) doesn't work, only editing the main language file (fr.xml) works. If regional files exist they should be used by Prestashop. Either I'm doing something wrong, or there's a bug in the way Prestashop handles this.

1.7.6.2 Bug CLDR Currencies FO International waiting for dev

All 8 comments

Hi @tm-newslang,

The first part of feature #10052 is almost done which the implementation of the CLDR (the data needed to manage a maximum of currencies), Check the PR #10455

It's planned to remove the number of the decimal parameter in Shop parameters > General, as you can see here: #12223
And it's also planned to add this feature in CLDR part 2: #11660, so on the next version 1.7.7, you could add any currency as you want and customize it as you wish. Check the feature's progress on this issue #11660. But we will not automatically update the exchange rate for customs currencies.

Thanks to check & feedback.

Hi @khouloudbelguith, thanks for the answer!

I wasn't aware of all this. So right now with version 1.7.6.2 I still need to edit the fr.xml file in order to get the right decimal and group symbols for example? Editing fr_CH.xml won't work?

I'm currently writing a full blog post on the subject (that I'll update following the future evolutions of PS), and I wanted to explain the process PS 1.7.6.2 takes to handle currency formats, but right now it's not working as expected.

I just need to know exactly how I can handle that right now so that I can use it on my current projects and inform people the right way. If right now I need to update the fr.xml file it's ok with me, but I need to be sure there's no other way.

Thanks!

@tm-newslang, so in this file, you just edited this line: https://github.com/PrestaShop/PrestaShop/blob/1.7.6.2/localization/CLDR/core/common/main/fr_CH.xml#L211
& replaced it by this

                <decimal>.</decimal>
        <group>'</group>

Is it?

Thanks!

I also changed this line:
https://github.com/PrestaShop/PrestaShop/blob/4d2d6ae2e6a38e345f35ac09beb42817db331da5/localization/CLDR/core/common/main/fr_CH.xml#L223

To this :

<pattern draft="contributed">陇 #,##0.00;陇 -#,##0.00</pattern>

None of this worked.

But when I did the change in the following file: https://github.com/PrestaShop/PrestaShop/blob/4d2d6ae2e6a38e345f35ac09beb42817db331da5/localization/CLDR/core/common/main/fr.xml

It worked after clearing the cache.

Thanks!

@tm-newslang, but this line <pattern draft="contributed"> does not exist in this file: https://github.com/PrestaShop/PrestaShop/blob/1.7.6.2/localization/CLDR/core/common/main/fr.xml
Is it?

Thanks!

@khouloudbelguith Yes it exists: https://github.com/PrestaShop/PrestaShop/blob/4d2d6ae2e6a38e345f35ac09beb42817db331da5/localization/CLDR/core/common/main/fr.xml#L7302

But there's no draft attribute. I'm working with V 1.7.6.2 that may be why, when I copied it I retained this attribute. But even without this draft attribute fr_CH.xml settings aren't used by PS.

@tm-newslang, yes!
I have the same behavior with PS1.7.6.2
If I change fr.xml
From

            <decimal>,</decimal>
            <group>聽</group>

to

            <decimal>.</decimal>
            <group>'</group>

And From

                <currencyFormat type="standard">
                    <pattern>#,##0.00聽陇</pattern>
                </currencyFormat>

to

                <currencyFormat type="standard">
                    <pattern>陇 #,##0.00;陇 -#,##0.00</pattern>
                </currencyFormat>

Changes applied => OK
But if I try to change the fr_CH.xml file
From
<currencyDecimal>.</currencyDecimal>
to

            <decimal>.</decimal>
            <group>'</group>

And From

                <currencyFormat type="standard">
                    <pattern draft="contributed">#,##0.00聽陇聽;-#,##0.00聽陇</pattern>
                </currencyFormat>

to

                <currencyFormat type="standard">
                    <pattern draft="contributed">陇 #,##0.00;陇 -#,##0.00</pattern>
                </currencyFormat>

Changes not applied in the FO.

Ping @jolelievre what do you think, this is normal behavior or a bug?

Thanks!

@khouloudbelguith Exactly! Hope we'll find a solution or at least an explanation.

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

centoasa picture centoasa  路  3Comments

zuk3975 picture zuk3975  路  3Comments

nrcjea001 picture nrcjea001  路  3Comments

marionf picture marionf  路  3Comments

hiousi picture hiousi  路  3Comments