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

Support for RTL languages #1929

Draft
wants to merge 10 commits into
base: 6.dev
Choose a base branch
from
Draft

Conversation

nawafinity
Copy link

@nawafinity nawafinity commented Mar 26, 2022

Overview

I've been using ExpiressionEngine before it became open source, I really like it, and as an Arabic speaker I've been waiting for support for RTL languages for a long time and have recently been working on the Arabic language package and during that I decided to do the work needed to support RTL languages.

In this PR, I did the following:

  1. I used the rtlcss library to make a right-to-left version of the control panel styles. (The library is used by Bootstrap and Netflix and many projects).
  2. I have added a new method in Lang.php that helps to get the language direction.
  3. I added two new scripts on package.json
    • rtl:css Which you can use after build:css to create an RTL version of cp-styles.
    • rtl:demo-css Which you can use to create RTL version of user/site/default styles.
  4. I added a new view global variable "lang_dir" which can be used <html dir="{lang_dir"}> and also modified the variable {lang}.
  5. Both view variables {lang} and {lang_dir} are now conditional variables so user can do something like:
    image
  6. I also modified Jump Menu script to support RTL.

Hope I did everything right.

image

Resolves #844.

Nature of This Change

  • πŸ› Fixes a bug
  • πŸš€ Implements a new feature
  • πŸ› Refactors existing code
  • πŸ’… Fixes coding style
  • βœ… Adds tests
  • πŸ‘½ Adds new dependency
  • πŸ”₯ Removes unused files / code
  • πŸ”’ Improves security

Is this backwards compatible?

  • Yes
  • No

Documentation

User Guide Pull Request: https://github.com/ExpressionEngine/ExpressionEngine-User-Guide/pull/NNN

@CLAassistant
Copy link

CLAassistant commented Mar 26, 2022

CLA assistant check
All committers have signed the CLA.

@intoeetive
Copy link
Contributor

Hello @nawafinity and thank you for your contribution.

This looks pretty solid already. We'll give it some more testing and then approve. Thanks!

@nawafinity
Copy link
Author

Hello @nawafinity and thank you for your contribution.

This looks pretty solid already. We'll give it some more testing and then approve. Thanks!

Hello @intoeetive ,
I am glad that you are satisfied with the work.
I'm currently working on getting ExpressionEngine to support languages other than English in creating slugs.

chrome-capture-2022-2-30

Language Support
Arabic βœ…
Latin βœ…
Greek βœ…
Turkish βœ…
Russian βœ…
Ukranian (πŸ’–) βœ…
Czech βœ…
Polish βœ…
Latvian βœ…
Armenian βœ…

@intoeetive
Copy link
Contributor

@nawafinity is Arabic language pack for EE available for download somewhere? If not, can you send it to us? (even if it's incomplete, just for the testing purposes)

@intoeetive intoeetive mentioned this pull request May 4, 2022
10 tasks
@intoeetive intoeetive added the community feature Someone from the community is willing to work on this label May 4, 2022
@intoeetive intoeetive added this to the 6.4.0 milestone May 4, 2022
@nawafinity
Copy link
Author

Hello @intoeetive, sorry for the late reply, I was I've been very sick lately, you can find in the attachments the incomplete Arabic language pack.
arabic.zip

Right now I'm facing a problem with Popperjs it does not support RTL so I'm trying to upgrade it to version 2 or find a way to make it work with RTL layout.

Copy link
Contributor

@intoeetive intoeetive left a comment

Choose a reason for hiding this comment

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

@nawafinity sorry it took so long to do the in-depth review - everyone was busy getting EE7 out.

I've spotted few issues which I think need to be solved before we can merge this in:

  1. The built-in fields (such as title, url_title, entry dates etc) are currently forced as LTR. I think it's reasonable for title and url_title to follow the language direction, but I'm not sure about the date fields?

  2. It looks like the dropdown for entry status does not work when I switch the CP to Arabic (the other dropdowns

  3. Looks like we need a way to force the LTR text direction for the specific fields. Currently in settings URL fields look like /http:https://ee6.local which is obviously not correct

  4. I don't think specifying the character map for URL title generation directly in JS file is the way to go. We have dedicated config file to store the mapping: https://docs.expressionengine.com/latest/config/config-files.html#foreign-characters
    But I also not 100% sure we need to overload it with the full map for all languages... maybe that's something that could be done as part of language pack... not sure. Just noting this need to be handled in more "generic" way

  5. I also see stuff in the JS that is a) specific to just Arabic language and b) specific to your needs maybe? Like making URL titles support Arabic - I would assume not everyone would want that. So at the minimum, that needs to be configurable.

All in all, this seems to be more complex than it seemed initially.

I feel like # 1, 4, and 5 could be skipped from the PR, but the # 2 and 3 need to solved at the minimum.

I'll make the PR draft for now.

If you are not able / willing to contribute into this more currently, maybe you could just provide some ideas on the path to go, because out in-house experience with the RTL languages is quite limited.

Thank you

@intoeetive intoeetive removed this from the 6.4.0 milestone Aug 16, 2022
@intoeetive intoeetive marked this pull request as draft August 16, 2022 14:25
@mustafa-online
Copy link

Hope this get merged soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community feature Someone from the community is willing to work on this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EE6 - RTL Support?
4 participants