-
Notifications
You must be signed in to change notification settings - Fork 107
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
Detecting directionality from script type (or from a language associated with a script) #205
Comments
That's issue #46. At Mozilla we landed let data = mozIntl.getLocaleInfo('ar');
data === {
'locale': 'ar',
'direction': 'rtl'
}; and in the future we plan to add more bits to it. |
Great, thanks! If one just wanted to know the script's directionality, one could just add the 4-letter script code to any language I presume, e.g., |
Btw, I don't see |
I see a bunch of things we can do here:
To get the direction, with an API based on Intl.Locale, with the data coming from the script as in 3, can I suggest something like this? new Intl.Locale('ar').withLikelySubtags().direction |
1 with 3 sound excellent to me (and if 2 was exposed as well, wfm). As far as 4, I don't currently have a need for this myself, but FWIW, it was brought up at #90 (comment) . |
I was imagining that (To continue the story: That Locale would have a particular |
I see. No, I was just thinking that since you mentioned the API as Re: locale having a |
The subtags here are the region and script :/ |
Ahh, gotcha... Ok, no worries--I think that should work... While it's helpful to try to accommodate possible use cases, I think a single script association should cover the most critical cases... |
To use that, the script for a given locale should be obtained in one way or another, shouldn't it? I'm afraid average developers are less familiar with script than locale/language. So, I think what @littledan suggested may work better. |
Note: we ended up naming the |
I intend to address this issue by proposing https://github.com/FrankYFTang/proposal-intl-locale-info/ |
@sffc Now that the Locale info proposal is Stage 3, can we close this? Or perhaps we would want to close on Stage 4? At the very least we should drop the "user preferences" tag I feel. |
Agree w/ @ryzokuken |
I dropped the label, but I prefer to keep these issues open until the proposal reaches Stage 4 and is actually merged into the standard. |
This is being addressed by the Intl Locale Info Proposal https://github.com/tc39/proposal-intl-locale-info?tab=readme-ov-file#text-information |
In order to set default text directionality, I think it would be helpful to have a means of mapping scripts (as by ISO 15924 code), though even more usefully, as languages with a specific "Suppress Script" in the IANA registry (indicating a predominant association of that language with a given script) to the script's directionality (RTL, LTR, Inherited, T-to-B, or Varies). One could then have a standard means (using HTML
dir
with RTL languages or CSS writing modes for T-to-B ones) of programmatically setting directionality for locales or for providing excerpts of other language-encoded content (when directionality information was not also present).The text was updated successfully, but these errors were encountered: