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

RTL support #27

Open
mohamadjavadx opened this issue Jan 4, 2021 · 17 comments
Open

RTL support #27

mohamadjavadx opened this issue Jan 4, 2021 · 17 comments
Labels
enhancement New feature or request

Comments

@mohamadjavadx
Copy link

mohamadjavadx commented Jan 4, 2021

Is your feature request related to a problem? Please describe.
well first of all thanks for quick fix on #24

Right to Left support is the feature that I think it would nice to have on this lib
currently if we try using this library on languages like farsi or arabic, the position of buttons, text, horizontal recycler view, and ... are not appropriate

Describe the solution you'd like
also it's easy to implement
just add another copy of layout with tag (android:layoutDirection="rtl") on root layout or kotlin code (window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL)

Additional context
I think this link is super helpful
https://material.io/design/usability/bidirectionality.html

@mohamadjavadx mohamadjavadx added the enhancement New feature or request label Jan 4, 2021
@maxkeppeler
Copy link
Owner

I don't have experience with this yet. I just enabled pseudoLocalesEnabled and used arabic locale on my device - and most of the bottom sheets mirror the layout perfectly. Why do I need to add window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL?

@maxkeppeler
Copy link
Owner

I see that the OptionSheet in LIST style doesn't align the text to the right. And numbers are not localized (I did not even know that this is a thing). And icons need to be localized as well, especially for the ClockTimeSheet and TimeSheet.

@mohamadjavadx
Copy link
Author

well actually we making apps fully forced to RTL and use native language of that country , regardless phone language or location so I personally put ((android:layoutDirection="rtl")) to every xml file to achieve this.

I think if there was a setter which force layout locale it would nice

@mohamadjavadx
Copy link
Author

some example for clefication:

image

image

image

image

@maxkeppeler
Copy link
Owner

But what you showcase automatically happened, when my phone was in a rtl language and then it enforced the rtl mirroring in the sample app, without me adding anything. So you want to override that to always enforce rtl and never ltr?

@mohamadjavadx
Copy link
Author

mohamadjavadx commented Jan 5, 2021

automatically happened, when my phone was in a rtl language and then it enforced the rtl mirroring in the sample app

well this is not true, because as you see for example the number pad is mirroring too which it should not, and there are some other cases like this
image

So you want to override that to always enforce rtl and never ltr?

yes, it's only way to achieve a native app (by native I meant a fully Arabic app that Arab people are going to use or any other RTL language )

@maxkeppeler
Copy link
Owner

I have a few more questions now.

  1. What about the time & calendar value, does it need to be mirrored too?
  2. Why do you suggest the switch between the icon buttons? I guess the icon itself should be mirrored, but not its position?
  3. In the photo, the title should be aligned to the close icon button?
  4. If it's rtl, why is the order of the numbers still ltr? When I check the guidelines, I don't recognize a rule which would prevent it from being mirrored (time relevance etc.)

@maxkeppeler
Copy link
Owner

I also have trouble displaying the TextInputLayout Hint to rtl and found this issue:
https://issuetracker.google.com/issues/37055931

Any idea how to fix this? The hint stays aligned to the left and animates upwards to the outlined box. (That's in rtl the same place where the endIcon is.)

@mohamadjavadx
Copy link
Author

  1. What about the time & calendar value, does it need to be mirrored too?

numbers are LTR in all languages so the answer is no, so for time hh:mm:ss, and for date yy:mm:dd
(however the calendar is useless Persians and Arabs have there own calendar system one based on sun and the other based on moon position from earth)

2. Why do you suggest the switch between the icon buttons?

I don't suggest switch between the icon buttons, my point was a horizontal list view in RTL view should start from right, and about icons it's overkill to mirror them but if you feel to it, it's ok

  • In the photo, the title should be aligned to the close icon button?

I don't get what you mean

4. If it's rtl, why is the order of the numbers still ltr? When I check the guidelines, I don't recognize a rule which would prevent it from being mirrored (time relevance etc.)

numbers are LTR in all languages, and I can't explain it to you well because of my poor english but trust me, and if you want I can draw layouts that you are not sure about

I also have trouble displaying the TextInputLayout Hint to rtl

that's not a good idea to force TextInputLayout to rtl or ltr, the language of text decide it self

@mohamadjavadx
Copy link
Author

just set textAlignment to viewStart and it's ok

@mohamadjavadx
Copy link
Author

wow we talked a lot about this
I think this library is super cool
if I have some free time I will contribute and add this my self, but it's like 2 month later, right now I'm in middle of some project.
btw thanks

@maxkeppeler
Copy link
Owner

Unfortunately not. Text alignment and gravity has no effect on the animated TextInputLayout hint. 🤔

@maxkeppeler
Copy link
Owner

maxkeppeler commented Jan 6, 2021

Current progress is in the branch feature-bidirectionality, I probably finish it before you have time - I have to get a better understanding of the changes in rtl mode. And thanks!

@mohamadjavadx
Copy link
Author

Unfortunately not. Text alignment and gravity has no effect on the animated TextInputLayout hint. 🤔

Rec.0003.mp4

@mohamadjavadx
Copy link
Author

Current progress is in the branch feature-bidirectionality, I probably finish it before you have time - I have to get a better understanding of the changes in rtl mode. And thanks!

cool, maybe I try to provide it in farsi language not just rtl

@maxkeppeler
Copy link
Owner

maxkeppeler commented Jan 6, 2021 via email

@mohamadjavadx
Copy link
Author

That's weird, so It only works with a rtl language? When enforced rtl with a ltr language, it stays on the left despite the gravity. But that's great, that fixes this problem.

On Wed, 6 Jan 2021, 16:00 mohamadjavad @.***> wrote: Unfortunately not. Text alignment and gravity has no effect on the animated TextInputLayout hint. 🤔 https://user-images.githubusercontent.com/57070063/103782761-1d58e100-504d-11eb-8613-269ff0668316.mp4 — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#27 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTAQMBAZE5NJ2NTQDHGEETSYR3HFANCNFSM4VSJJ4LA .

yes, there is no problem language will take care

@maxkeppeler maxkeppeler added this to To do in Sheets Board Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

No branches or pull requests

2 participants