Locale with numbers which use comma instead of dot as decimal separator works wrong

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
I have default Language Bulgarian. And I set display locale to Bulgarian at Language and at Currency which is BGN. But when I try to save Currency rate as 1.0000 it is saved as 1,0000 and after that it loads the value as 10000.0000 which totally mixed up all my prices.
9 years ago
Hi,

I've just tested. It works fine out of the box.

Please note that admin area uses "en-US" culture info out of the box no matter of a chosen language. How you changed this default behavior? It could be the reason
9 years ago
Hi,

Here are steps to reproduce:
1. Adding two languages - Bulgarian and English, and only one currency - BGN
2. Setting to them correct locale - bg and en-us
3. Selecting English at admin site
4. Adding new product with price 0.2000
5. Changing Admin language to BG
6. Opening previously added product
7. The price is 2000.0000
8. Try to change it back to 0.2000 and to save it -There is an error "The value '0.2' is not valid for Price."

If I want to have only Bulgarian language, I have this price saving problem!
9 years ago
Hi,

Thanks for the list of steps. But please see post above.  It works fine out of the box. Admin area always uses "en-US" culture info out of the box (even if you set it to "bg-BG"). It's explicitly set in \Presentation\Nop.Web\Global.asax.cs file:
CommonHelper.SetTelerikCulture();


Implementation:

        /// <summary>
        /// Set Telerik (Kendo UI) culture
        /// </summary>
        public static void SetTelerikCulture()
        {
            //little hack here
            //always set culture to 'en-US' (Kendo UI has a bug related to editing decimal values in other cultures). Like currently it's done for admin area in Global.asax.cs
            
            var culture = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture = culture;
            Thread.CurrentThread.CurrentUICulture = culture;
        }
9 years ago
Thanks Andrei!

Can I edit Global.asax.cs , rebuild and copy and replace only some files on the ftp or I need to push the whole source?
9 years ago
There's no need to edit it. It already has this code out of the box (of course, if you did not remove it). If you edit it, then you should rebuild the soluyion and upload /bin/Nop.Web.dll file
9 years ago
Hm, I think this hack is not fully working.
If you follow this steps you can see the bug persists.
I want to remove English from languages, but when I have done this my price is not 0.2, it is 2000.0000. That means the culture is not en-US in admin panel ?!
9 years ago
Pleae see my posts above. It is always en-Us in admin area. I cannot reproduce it on the clean installation. Everything works fine
9 years ago
I have seen your post and yes the UI at admin page is set to use en-US, but you can see what is in the DOM with language locale bg-BG:

<input aria-readonly="false" aria-disabled="false" aria-valuenow="2000" class="k-input valid" style="display: none;" role="spinbutton" data-role="numerictextbox" data-val="true" data-val-number="The field Price must be a number." data-val-required="'Price' must not be empty." id="Price" name="Price" value="0,2000" type="text">


The input value is with comma for decimal separator, and when the UI is set to en-US it thinks this value is with hundreds separator.

My computer time zone is set to (if that have some relation to the problem):
UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius

When I change the language display locale to en-US, everything is OK, but all date time strings are in English.
8 years ago
I have same problem. please help.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.