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 RTL Support for widget and portal. #9275

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

nawafinity
Copy link

@nawafinity nawafinity commented Apr 22, 2024

Pull Request Template

Description

This pull request introduces RTL (Right-To-Left) support to widgets and portals, ensuring compatibility with languages that utilize RTL layouts. It features the introduction of a new rtlMixin specifically designed for widgets, alongside updates to the existing rtlMixin for the dashboard. This update leverages Tailwind CSS's utility classes for dynamic layout direction based on the dir attribute.

e.g.:

<div class="flex rtl:flex-row-reverse">
.example {
    text-align: left;
    [dir='rtl'] & {
        text-align: right;
    }
}

A new Ruby initializer (~/config/initializers/i18n_extensions.rb) has been added to automatically set the document language and direction.

Supported languages include:

  • ar (Arabic)
  • arc (Aramaic)
  • dv (Divehi)
  • fa (Persian)
  • ha (Hausa)
  • he (Hebrew)
  • khw (Khowar)
  • ks (Kashmiri)
  • ku (Kurdish)
  • ps (Pashto)
  • ur (Urdu)
  • yi (Yiddish)

Fixes #7407 #7141

Examples:

RTL LTR
localhost_3000_widget_tests_position=right locale=ar localhost_3000_widget_tests_position=left locale=en (1)
localhost_3000_widget_tests_position=right locale=ar (1) localhost_3000_widget_tests_position=left locale=en (2)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

This feature was tested in a local development environment using unit tests to verify that changes correctly apply RTL styles based on the dir attribute. Manual testing was also performed to ensure that widgets and portals render appropriately in supported RTL languages.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@nawafinity nawafinity changed the title Widget rtl Support RTL for widget and portal. Apr 22, 2024
@nawafinity nawafinity changed the title Support RTL for widget and portal. feat: Add support RTL for widget and portal. Apr 22, 2024
@nawafinity nawafinity changed the title feat: Add support RTL for widget and portal. feat: Add RTL Support for widget and portal. Apr 22, 2024
Copy link
Member

@scmmishra scmmishra left a comment

Choose a reason for hiding this comment

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

Hey @nawafinity I can see that you have made changes to the translation files as well in this PR. It would be great if you could make those changes in a separate PR. Also in case you want to update translations, you can do them here: https://translate.chatwoot.com/

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.

[CW-2179] RTL Widget
2 participants