chatwoot icon indicating copy to clipboard operation
chatwoot copied to clipboard

feat: Add RTL Support for widget and portal.

Open nawafinity opened this issue 10 months ago β€’ 7 comments

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

  • [x] 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:

  • [x] My code follows the style guidelines of this project
  • [x] 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
  • [x] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules

nawafinity avatar Apr 22 '24 15:04 nawafinity

@nawafinity is this ready for test? I could help.

@scmmishra it would've been great to have text direction settings in widget and kb portal. This way I can keep my chatwoot UI in English and have the chat widget correctly set to RTL.

hadifarnoud avatar May 19 '24 11:05 hadifarnoud

i like this feature to be merged its so useful !

mmeshkatian avatar May 19 '24 11:05 mmeshkatian

Hey @scmmishra,

I will make these changes this week and finalize this PR.

@hadifarnoud, it’s almost ready. I’m currently running some tests and preparing to update the branch.

This PR will be finalized as soon as possible.

Thank you, Nawaf

nawafinity avatar May 20 '24 06:05 nawafinity

🐒 Turtley slow progress alert! This pull request has been idle for over 30 days. Can we please speed things up and either merge it or release it back into the wild?

github-actions[bot] avatar Jun 20 '24 03:06 github-actions[bot]

Wonderful, any updates?

TheMikeyRoss avatar Jul 25 '24 15:07 TheMikeyRoss

any news about this issue?

abehnamfard avatar Aug 12 '24 12:08 abehnamfard

any news about this issue?

abehnamfard avatar Aug 12 '24 12:08 abehnamfard