Skip to content

Conversation

shimile
Copy link
Contributor

@shimile shimile commented Jan 30, 2017

Please note that for proper display of Hebrew, the page HTML tag needs to have dir="rtl"

Please note that for proper display of Hebrew, the page HTML tag needs to have dir=rtl
@abh
Copy link
Owner

abh commented Jul 4, 2017

This is great, thank you. I'll add support for marking languages rtl and merge this and push it to the beta site.

@abh abh added the translation label Jul 4, 2017
@abh abh added this to the v2.2 milestone Jul 4, 2017
@abh
Copy link
Owner

abh commented Aug 19, 2017

One bit of trouble I ran into was with pages with "mixed languages". I need to learn a little bit more about how people implement RTF. Anyway, just an update that it's still in progress..

@shimile
Copy link
Contributor Author

shimile commented Aug 19, 2017 via email

@abh
Copy link
Owner

abh commented Sep 29, 2018

Thank you for the explanation. I was fussing with it a bit more. I started adding a "rtl" option in the list of languages in code, but in the code which language gets pulled in is quickly abstracted away (basically if it's the translation or an English fallback).

Given your explanation I wonder if it'd make most sense to just wrap the Hebrew .html files (the ones you translated) in ... ?

@shimile
Copy link
Contributor Author

shimile commented Sep 29, 2018

Sorry but I kind of lost you on where the problem is. Let me give an example of how I would build a multi-lingual website that also supports languages that aren't read left-to-right.

In general I like to work with the concept of functional decorators. Meaning: functions (or methods if you're into OO), that get some input as a parameter (or setting a variable in a renderer object if OO prior to calling its' main render() method).
So for example I would probably have decorators for headers and footers of pages; These will receive inputs such as: Language, Encoding, Title, Device type (desktop/mobile), etc. And when asked to render, will conditionally create HTML to accommodate all these settings. If you work in that method, then all that is needed, is in pages where the language is Hebrew, is to pass "Hebrew" as the language to the decorator. The decorator will then have an if () statement for creating the first HTML tag, 'html', and the if will check if "language" is included in (list of RTL languages), and if so, instead of outputting 'html', it will output 'html dir="rtl"'.

In cases where inside the Hebrew page I will have to have something left-to-right, like code snippets, I could just specifically wrap them with some tag that says direction: ltr in its' CSS, or even simpler, since those code snippets will likely ALWAYS be left-to-right, regardless of language, then the 'direction: ltr' can just be in the global CSS file defining the regular styling of code snippets; Since these CSS classes will be more-specific than the HTML which is in the outermost scope, they'll prevail, and code snippets will be displayed left-to-right in right-to-left pages without needing to add special code within the page or the translation text.

That's all that is needed, assuming that you have some rendering engine that decides what it is going to show and pass that information forward if you have some renderer.

Hope this helps?

@shimile
Copy link
Contributor Author

shimile commented Sep 29, 2018

or... if it's simpler, you could (if possible) use the gettext/equivalent template engine and just define a string for direction (_ltr), which by default render as "ltr", and could be "translated" to "rtl", and put that string on all HTML pages in the html tag; since "ltr" is the default, on non-"translated-to-rtl" languages there will be no effect (dir will be ltr), and on RTL languages we can translate it to 'rtl'... reversing the direction.

@abh abh merged commit 04e9596 into abh:master Sep 7, 2019
@abh
Copy link
Owner

abh commented Sep 7, 2019

Hi @shimile -- thank you again for this! It will be on the beta site shortly https://web.beta.grundclock.com/en/

I didn't do the rtl changes yet, so I am guessing it's all broken, but I figured better get the completed work merged in.

Reading through my old questions and your comments I have some new ideas for how to make this work. I think there was another RTL translation recently, too, that's probably also broken!

@abh abh mentioned this pull request Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants