-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: calcite-input showing Arabic characters for numbers only, add an option to switch to western numbers #3079
Comments
More information is required to proceed with this issue:
This issue will be automatically closed in three days if the information is not provided. Thanks for your understanding. |
Reproducible in Firefox: https://jsbin.com/yarikuquji/edit?html,output |
@AdelheidF, where does the requirement to only support English numbers come from? |
@AdelheidF here is my perspective on this: What Map Viewer has implemented or restricted users to (English numbers), is Map Viewer (or even Esri app) app specific. Calcite is not only for internal esri-developed apps, but also for public to use and create solutions/GIS apps. For that, it would be best to not exclude or restrict our users to only use English/western digits. |
Ok, is there an option to change it to western? It doesn't really matter to me, I'm trying to follow what the i18n team (Olga in this case) is suggesting. |
@AdelheidF let me talk to Olga and get back to you and clarify. |
@AdelheidF I chatted with Olga on what she recommended originally and the different recommendations between Olga's and mine. What Olga did not know when she gave her recommendation, is that Calcite is now a customer-facing product/platform, released to global non-Esri people. Given this new information, she agrees with my recommendation - to support Arabic indic digit in Calcite input. pls let us know if you have additional info or if we can help in anyways - coding, testing, etc cc: @julio8a |
Talked to Olga again and we do want western numbers inside the Map Viewer, because every other piece displayed in that app uses western numbers. Could we add an option so we can switch between western and Arabic numbers for |
There's already a way in HTML to set a language for a specific element using the |
Are you saying that we should check if the currently user language is Arabic and then overwrite it with English (+RTL) instead when using input? If this is the case this is not going to work, we cannot add language specific behavior everywhere. A prop that would make the input component use only English numbers in any language is OK, because the prop can stay for all languages. |
@AdelheidF what i'm saying is that we don't need to add another property for this, we should use the native HTML one (lang). If a developer wants to always use english, they can use The component should support whatever lang is set or inherited on the component and the browser should render numbers for that lang. If the component isn't doing that currently, it should update to do so using this issue. Currently, calcite-input has a
This prop is problematic because it only looks at the document.lang whereas it should probably look at the element first and then use closest() to get the lang. |
Looks like if you set the |
Sorry, I still don't understand how this should work. Below, you can see that French has a comma decimal. If I overwrite @jcfranco could you comment here? You will run into the same issue with SymbolStyler. |
Can the locale include the numbering system? This is how we override the default numbering system for |
@dasa which API is that? just wondering if all browsers honor this 'u' extension |
Sorry, I was referring to the JS API, but yes, all browsers support the extension: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat |
@anveshmekala I put in a PR that fixes the issue |
@Olga8614 @annierm18 - Can we have some clarity on this issue, we are looking at two options:
It sounds like most Esri products went with option 2, however Calcite Components also serves non-Esri users. We usually prefer to maintain browser defaults, but I'd appreciate advice on the best option here since there are mixed opinions. Thanks! |
I'd prefer to maintain browser defaults as well. We should be consistent with native HTML elements. |
It does not make sense to have it work differently between browsers. Calcite components should be better than native HTML elements. And since most users of calcite are Esri products I prefer having the default to be Latin. All numbers appearing otherwise on the page, e.g. in text, will be Latin. Number input is a very commonly used component and we'd have to add |
There are two sides to this! from one point of view, we need to adapt to customer environment and not force something on them. If they are used to seeing Arabic digits in their choice of browser (Firefox) with everything they do, then we probably need to honor it. on the other hand, it would be good to be consistent WITHIN Esri apps. So we may need to be consistent with JSAPI-enabled esri apps. |
It seems like we are trying to fix a firefox bug. Is there a firefox issue for this that we can maybe track and remove this logic once its fixed? |
Sometimes browsers just make different choices, which is always fun. But I'll look for a FF bug. @babakbolour - it sounds like you're saying we should go with option 1 then, and that all of the Esri teams that use the CC need to set the |
Yeah, it kind of sucks but I lean toward just honoring what they return for |
The default for Safari is also "arab". |
Does calcite-slider also support |
I noticed calcite-stepper, calcite-date-picker, and calcite-time-picker don't seem to use Arabic numbers by default in FF and should probably support |
To provide more clarity, the default numbering system for |
CLDR reference for arabic https://icu4c-demos.unicode.org/icu-bin/locexp?d_=en&_=ar |
I agree that we should try to align whenever possible with browser defaults, but it doesn't mean we can't make adjustments to make it easier for our users (e.g., |
Installed and assigned for verification. |
Alright, thanks for your patience everyone. The default numbering system for arabic is now latin in all browsers. We will be releasing <calcite-input numbering-system="arab" type="number" value="5"></calcite-input> |
I thought we had already created follow-up issues for this. 🥲 @benelan can we create an issue to update additional components that display numbers? Aside from @AdelheidF Thanks for the reminder. 🏆 |
new issue: #4893 |
Verified the default numbering system for Arabic is Latin across browsers, and when using the Follow-up for the |
cc @eriklharper |
Original issue submitted by Olga.
In FF and Safari when language is set to ar numbers in the input boxes appear in Arabic. Chrome doesn't have this problem, it is always showing English numbers. We only want to see English numbers, no matter the user's language.
When dragging the dot of color picker over the colored area the values update with other Arabic numbers.
Same when using up and down arrows.
https://jsbin.com/dutarurohu/edit?html,output
I'm using beta.65, but I also see it with beta.59.
Actual Behavior
Showing Arabic numbers
Expected Behavior
only English numbers
Reproduction Steps and Sample
Sample:
Contact me
Relevant Info
Version:
@esri/calcite-components@beta.65
The text was updated successfully, but these errors were encountered: