-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: Add new isRTL
function
#639
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this feature.
It seems you use the locale used by the person creating the form. This is not ideal. I might use English but I want to create a form in RTL (or the opposite).
There are two proposals:
- Add an option to set the direction of the form (this can get its default value from the locale of the creator of the form). This is flexible but not yet not preferred.
- Make any user-generated field/content to set the direction automatically using
dir="auto"
. Here, we need to also fix any styles related to left|right to use logical styles (liketext-aligh: start
orpadding-inline-start|end
,...
I prefer the last one. It is very flexible and no magic logic is required to be implemented.
@ahangarha Thank you for your feedback, I think it should be on the forms issue. Lets discuss the forms part there :) And it is not about the creator of the form, but this feature would use the current users locale / language, as Nextcloud let you configure a language other than your user agents language which overrides the user agent. |
…nt, language is right-to-left read Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
3da0042
to
9f3f345
Compare
Oh! Sorry for mistaking the PR. |
// special case for Uzbek Afghan | ||
if ((language || getCanonicalLocale()).startsWith('uz-AF')) { | ||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we check for locale and not only the language here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Language is never falsy but at least "en"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Add
isRTL
to check whether a given, or the current, language is right-to-left read.Use cases would be e.g. nextcloud/server#31420 or nextcloud/forms#1637
🧪 Testcases included