Skip to content
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

Merged
merged 1 commit into from Jun 25, 2023
Merged

feat: Add new isRTL function #639

merged 1 commit into from Jun 25, 2023

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jun 24, 2023

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

@susnux susnux added enhancement New feature or request 3. to review labels Jun 24, 2023
Copy link

@ahangarha ahangarha left a 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:

  1. 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.
  2. 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 (like text-aligh: start or padding-inline-start|end,...

I prefer the last one. It is very flexible and no magic logic is required to be implemented.

@susnux
Copy link
Contributor Author

susnux commented Jun 25, 2023

@ahangarha Thank you for your feedback, I think it should be on the forms issue.
As this particular pull request is not about forms or any front end part, but just adds a requested function to determine if a given language is a RTL language or not.

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>
@skjnldsv skjnldsv merged commit c669b3c into master Jun 25, 2023
5 checks passed
@skjnldsv skjnldsv deleted the feat/add-is-rtl branch June 25, 2023 09:22
@ahangarha
Copy link

Oh! Sorry for mistaking the PR.
Well done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an isRTL method
3 participants