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

Web app: add RTL support #804

Merged
merged 2 commits into from
Jul 4, 2023
Merged

Web app: add RTL support #804

merged 2 commits into from
Jul 4, 2023

Conversation

nimbleghost
Copy link
Contributor

@nimbleghost nimbleghost commented Jul 3, 2023

Resolves #663
Resolves #700

MUI has pretty good RTL support, not much to do except connect mui & i18next.

I do not read an RTL language, so probably want someone else to double check that it looks correct, but going by my basic knowledge and the Material reference, it seems fine.

https://mui.com/material-ui/guides/right-to-left
https://m2.material.io/design/usability/bidirectionality.html


. . .
CleanShot 2023-07-03 at 15 23 13@2x CleanShot 2023-07-03 at 15 16 36@2x CleanShot 2023-07-03 at 15 14 37@2x
CleanShot 2023-07-03 at 15 25 27@2x CleanShot 2023-07-03 at 15 16 56@2x CleanShot 2023-07-03 at 15 17 00@2x
CleanShot 2023-07-03 at 15 25 58@2x

Copy link
Owner

@binwiederhier binwiederhier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I had two questions but I'm ready to merge.

useEffect(() => {
document.documentElement.setAttribute("lang", i18n.language);
document.dir = languageDir;
}, [i18n.language, languageDir]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question:

  • Should this not be i18n.resolvedLanguage everywhere? I had to do that in the preferences to avoid issues.
  • Have you tested this with a cleared localStorage, i.e. without a language?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • resolvedLanguage is specifically for preferences - it references a value in your supported languages, so you can match it to an option with the user. language is fine for all other use cases: https://www.i18next.com/overview/api#language
  • works fine in incognito. it will use the fallback language if it can't detect one based on what the browser reports, or if it doesn't match a supported language.

web/src/components/RTLCacheProvider.jsx Show resolved Hide resolved
@binwiederhier binwiederhier merged commit 495fb24 into binwiederhier:main Jul 4, 2023
3 of 4 checks passed
@nimbleghost nimbleghost deleted the rtl branch July 4, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date/time not following system locale Support RTL layout
2 participants