[FW][FIX] website: make multirange widget works with sr@latin lang code
The range widget doesn't work with Serbian language, because language locale subtag contains `@`. Steps to reproduce: 1. Activate Serbian Latin language (sr@latin) on your website 2. Go to /shop 3. Switch to Serbian lang The price ranger slider (which can be disabled) will throw this TB: "RangeError: Incorrect locale information provided". The fix is to do as other places in the code: replace this specific lang code with the expected one. Ideally, a util method should be used at all those places. closes odoo/odoo#148593 Forward-port-of: odoo/odoo#148279 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
@@ -264,7 +264,8 @@ export class Multirange {
|
||||
}
|
||||
|
||||
formatNumber(number) {
|
||||
const locale = document.querySelector("html").getAttribute("lang");
|
||||
const language = document.querySelector("html").getAttribute("lang");
|
||||
const locale = language === "sr@latin" ? "sr-Latn-RS" : language.replace(/_/g, "-");
|
||||
let formatedNumber = number.toLocaleString(locale, {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
|
||||
Reference in New Issue
Block a user