verbiricha/habla.news

Adding locale/translation

Closed this issue · 6 comments

Hi,
I'm trying to add a Hebrew translation for Habla yet to no avail:
I forked the repo, created a new folder named /he under /public/locales, then uploaded to that folder both common.json and onboarding.json files with full translations, installed and built the repo locally, then ran the server with the browser settings configured to display pages in Hebrew, yet when I go to localhost:3000 the translated content doesn't display. I know that the browser locale settings are loaded because the date is displayed in Hebrew plus it works for other languages like German...was there something else I was supposed to do?

Hi @simong1080 and thanks for the translation, we currently use Crowdin to manage translations https://crowdin.com/project/habla I just added Hebrew as target language. Could you translate it in Crowdin? It'll be automatically pushed to this repo and then i can add he to supported locales.

Done!

Awesome, just pushed it to production, thanks @simong1080 ! Do you have a npub or lightning address? I'd love to send you some sats for your time. Let me know if there are issues with Hebrew on the site, I've tried to make it RTL language friendly but may have missed some spots.

Great! You the man!

Re RTL, yes there are two issues.

  1. Layout display - elements are displayed LTR, when they should be RTL.
  2. Text display - even if parent element is displayed RTL, the child elements containing text are displayed as LTR.

image

I'm not sure how your HTML is generated, but there need to be dir="rtl" attributes in <html> and/or <div> - that fixes issue 1 (for example in https://habla.news/he/c - attribute needs to directly added to <div>). Only the lang="he" attribute is defined in <html> and this has no effect on the child elements.

image

image

As for text within elements such as <p>, those tags need to be directly altered.

image

It's important to note that resolving this issue would affect not just Hebrew but all RTL language display such as Arabic, Farsi, Urdu etc. so it's not just a Hebrew specific issue.

Appreciate your attention and generosity!

thanks for the thorough review @simong1080 💜 Can you give me your npub so I can send you some sats and mention you in the next Habla release? Thanks in advance!

You got it. This is important for the world.
But your fix only solves the text direction issue, not the layout issue. Block elements such as <div> and <p> are still aligned ltr. Please see attached screen capture. This is applicable to all pages, not just to what was captured. Interestingly layout of higher level elements on habla.new/he/c is fixed, though this isn't the case with the home page or article pages themselves...

habla-2024-02-09_11.03.02-00.00.01.412-00.00.31.058.mp4