Implement RTL support

Bug #1307356 reported by GunChleoc
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Undecided
GunChleoc

Bug Description

Support RTL scripts (Arabic, Devanagari, Farsi, Hebrew etc.)

We need to:

1. Reverse the order of GUI elements

2. Switch right-align and left-align for all text elements

3. Find font sets (c.f. https://bugs.launchpad.net/widelands/+bug/662800)

4. Some changes in the font renderers will be needed (c.f. https://bugs.launchpad.net/widelands/+bug/590874)

Related branches

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have started working on 1. in this branch: https://code.launchpad.net/~widelands-dev/widelands/rtl-reverse-gui

Could somebody please have a look if I'm on the right track and that I'm not missing an obvious way to do this more easily?

Also, I don't like this:

        i18n::Textdomain td("widelands");
        std::string ltr = _("LTR");
        if (ltr.compare("LTR") != 0)

I'd prefer a global boolean switch that is read from the .po only once in i18n. I tried and failed, and every time I touch the file pretty much the whole project has to be compiled again, which is taking quite long. Maybe somebody who has a faster machine and knows more C++ than I do could take a look at this?

Changed in widelands:
status: New → In Progress
assignee: nobody → GunChleoc (gunchleoc)
SirVer (sirver)
Changed in widelands:
assignee: GunChleoc (gunchleoc) → Shevonar (shevonar)
Revision history for this message
SirVer (sirver) wrote :

Oh wow, another project :)

> Also, I don't like this

Yep that is not good. Logic should be on the logic site. I suggest porting txt/languages to Lua and add for each language a boolean ltr or something and make this file easily accessible through a class.

Otherwise, the if/else approach is not a workable solution. It requires too much maintenance. In my mind this means two things to be done right:

1) Port all uses of the old text renderer (in src/graphic/font_renderer.cc) to the new one (src/graphic/font_renderer1.h) so that we only need to add RTL support to one of the renderers.

2) Change the way UIs are constructed. There are two ways here. What must happen defintively is to move away from absolute positioned elements to free floating elements that are layouted using Ui::Box. Because then AlignRight can be swapped to AlignLeft programmatically without the need to change (so) much.

Desirable, but optional would be to move the UI definitions then out into Lua files which will make tweaking the UI easier for other people - i.e. translators that are more tech savy. I assign Shevonar because he mentioned that he wanted to work on this - though he wanted to use XML which I hope we can stay away from :).

GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Confirmed
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
GunChleoc (gunchleoc)
Changed in widelands:
status: Incomplete → Confirmed
Revision history for this message
GunChleoc (gunchleoc) wrote :

Attaching a savegame with long nonsense filename in Arabic script for testing.

Revision history for this message
TiborB (tiborb95) wrote :

I saw these artifacts when testing table_align - see attachment. Might be not related though...

Revision history for this message
GunChleoc (gunchleoc) wrote :

That's unrelated - the author name is so long that the multiline textarea creates a second row, but there isn't any space for a second row. What yo are seeing are the top of some letters, e.g. t's or l's.

GunChleoc (gunchleoc)
Changed in widelands:
milestone: none → build20-rc1
GunChleoc (gunchleoc)
Changed in widelands:
assignee: Shevonar (shevonar) → GunChleoc (gunchleoc)
status: Confirmed → In Progress
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Triaged
GunChleoc (gunchleoc)
Changed in widelands:
milestone: build20-rc1 → build21-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.