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

Right-to-Left languages support #363

Open
axraph opened this issue Dec 29, 2024 · 5 comments
Open

Right-to-Left languages support #363

axraph opened this issue Dec 29, 2024 · 5 comments

Comments

@axraph
Copy link

axraph commented Dec 29, 2024

I was wondering, would you be open to add RTL support to the editor? MJML doesn't support it and it doesn't seem like they're going to anytime soon. Actually, the only newsletter app that supports RTL is Mailchimp :/

I know my way around HTML/CSS and I'd help with Arabic UI translation and testing.

@wmnnd
Copy link
Contributor

wmnnd commented Dec 29, 2024

Hey there, thanks for this suggestion and for wanting to help! I think making the interface work for RTL languages should not be too difficult, especially since Tailwind has rtl helper classes.

One thing I’m not sure about though is templating. How does that typically work? Can templating logic still remain LTR?

For example, does this work?

{% if true %} مرحبا بالعالم! {% endif %}

… or would you expect it to work like this?

{% endif %} مرحبا بالعالم! {% if true %}

@axraph
Copy link
Author

axraph commented Dec 30, 2024

Hi Philipp, thank you for looking into this.

Yes, the templating logic stays the same, the first example you shared is the correct one.

Ideally, the language and RTL direction need to be applied at a container level in the generated HTML:

<html dir="rtl" lang="ar">

A less accessible way would be to apply it via CSS: direction: rtl;

Either way, the direction only affects the front-end display, the code itself is LTR regardless. For example:

<p dir="rtl" lang="ar"> مرحبا بالعالم! </p>

Would be rendered like this:

Screen Shot 2024-12-30 at 10 30 57 AM

Notice how the exclamation mark is rendered, it came after the sentence as it should, although it looks flipped in the code.

@wmnnd
Copy link
Contributor

wmnnd commented Dec 30, 2024

Okay, so what would the steps be to support Arabic and other RTL languages? Am I missing something?

  • Translate strings to Arabic
  • Add RTL helper classes in UI where needed
  • Add RTL/language markup to email templates

@axraph
Copy link
Author

axraph commented Dec 30, 2024

Right now, the language switcher is at the account level, which would change the language of the backend UI and subsequently the template(s) and campaigns.

That might be too rigid for a real-life scenario, for example, one of my clients (who have a multilingual website) sends an English newsletter to the "media" segment while they send another newsletter in Arabic to their subscribers.

I propose to have a second language selector at the template level that's independent from the account language. A user could feel more comfortable in an English UI and still have the ability to send out campaigns in Arabic.

The language selector at the template level makes the most sense because it would also allow the user to edit the styles of the template like the fonts and maybe also the line-height (that would be a nice addition) to what makes sense for this particular language and their branding.

Let me know your thoughts on this and whether it make it too complicated to implement.

@wmnnd
Copy link
Contributor

wmnnd commented Dec 30, 2024

Yes, you should definitely be able to set the language at the campaign level. I’m currently completely reworking how templates and campaigns work, so support for this might still take a while. Though if you use MJML campaigns, you can already customize this.

So if you want to get started with the translation and UI adjustments, you’re welcome to create a PR 😊

You can take a look here on how to contribute code and translations: https://github.com/pentacent/keila/blob/main/CONTRIBUTING.md#contributing-code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants