[Pending] - Adding support for Right-to-left languages (Hebrew, Arabic...)

Discussion in 'Feature Requests' started by morpheus_xx, October 19, 2014.

  1. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    This thread is about adding support for languages that are written right-to-left.
    Supporting Hebrew depends on two things:
    • using a font which supports Hebrew characters
    • updating layouting engine to support "right to left" (RTL) languages
    First I'd like to show the current situation:
    This is the source, translation added at transifex webservice: 01_transifex.png



    And this MP2 in default skin looks like: 02_mp2.png
    I put a color border around the same words. If you look at them, you see them in "reversed order" rendered in MP2. This is due to the "right to left" writing order in Hebrew.

    Does any of our @Developers @Testers @SuperUser, @yoavain have experiences with those kind of languages?

    What other requirements to layout are there? Would it be required to switch complete menu to the right side (instead as shown above on left side)? Or would it be enough to support text properly?

    @staticx as you pointed us to the issue, what do you think?
     
    Last edited: October 19, 2014
    • Like Like x 1
    • Thank You! Thank You! x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    I made a quick test and reversed the string before rendering:
    03_reversed_strings.png

    While this is no valid approach, it shows an important fact to consider: if you look at the screen, you will find english "Latest media" also reversed. This means, a proper RTL-support is not a global "switch", but you need to consider each string (or even substring?) individually.
     
  4. yoavain
    • Premium Supporter

    yoavain Extension Dev

    Joined:
    May 24, 2009
    Messages:
    426
    Likes Received:
    304
    Gender:
    Male
    Occupation:
    Senior Software Engineer
    Ratings:
    +467 / 0
    Home Country:
    Israel Israel
    Show System Specs
    What about reversing strings at runtime only if they contains Hebrew/Arabic letters? (Runtime can also mean when reading once from transifex :))
     
  5. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    I think we need a clearer definition, as this won't work for a mixed letter string: (I copied this one from transifex as I can type and read any of those letters ;))
    שרת MP2 לא זמין
    You see, reversing the whole string is wrong, it would make MP2 to 2PM.

    But we could check each character for being in range of Hebrew (or any other RTL language): http://www.utf8-chartable.de/unicode-utf8-table.pl?start=1280 U+0590 - U+05FF.

    My test with string reversal was only to try if there will be a proper string rendered for Hebrew. Can you confirm this, is the text readable for you?

    The main problem will be the layout question: is it expected that everything (Menu, Controls, etc.) is also aligned RTL? I've seen Microsoft sites in Arabic, there is everything "mirrored". If we need this also for MP2, this will cause a lot of work for the layouting engine.
     
    Last edited: October 20, 2014
    • Agree Agree x 1
  6. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    @yoavain can you please check my bold marked questions above?

    A new question: is everything on this new screenshot is "written" correctly? I already know the text in player controls is wrong, because I only reversed strings that starts with a RTL character (which "-" is not).

    I'm still not sure if this is a way to go, I don't know if this is "enough"..
    04_partly_reversed_strings.png
     
  7. ysmp
    • Team MediaPortal

    ysmp Design Group

    Joined:
    May 17, 2008
    Messages:
    1,861
    Likes Received:
    701
    Gender:
    Male
    Location:
    Seoul.
    Ratings:
    +790 / 1
    Home Country:
    South Korea South Korea
  8. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    I think I can fix the known issue inside player control texts on top of screen. But after all this is only a very small part to support RTL layout:

    If you consider following parts:
    • menu: should it be on right side then?
    • the text inside the button: shouldn't it be right aligned for RTL? And what about the latin texts? Should they still remain left aligned or also right?
    • scrolling text: imagine the news ticker, if text is RTL and we scroll from right (as we do for latin alphabet), you would get the text from end to beginning
    This all means, that we properly can't simply do a "bit of support", as it would look strange in many parts.
     
  9. staticx

    staticx Portal Pro

    Joined:
    March 22, 2009
    Messages:
    140
    Likes Received:
    7
    Gender:
    Male
    Ratings:
    +13 / 8
    Home Country:
    Israel Israel
    Show System Specs
    Hello

    Thanks for your support!
    I think, that for first step, I can give up on the right-side menu. For start all I want is to be able to use the program, so what you've showed at post #5 is fine for now.
    please remember that MP Hebrew community is very small (we've "lost" most of MP users to XBMC....) so It's not urgent to move the men to right side and some other things...

    as for the text inside a button, I think it has to be RTL...
    scrolling text - not very important... we can give up the news ticker for now.. (anyway all the news are bad news o_O )

    thanks!
     
    • Like Like x 1
    • Agree Agree x 1
  10. morpheus_xx
    • Team MediaPortal

    morpheus_xx Lead Dev MP2

    Joined:
    March 24, 2007
    Messages:
    11,017
    Likes Received:
    4,750
    Ratings:
    +6,796 / 11
    Home Country:
    Germany Germany
    Show System Specs
    Yesterday I've read a lot more about the text handling. I did wonder why we have to deal with different orders at all inside MP2 rendering.

    The answer is, that the rext rendering engine is based on FreeType to get the glyphs (single character) from a given font. That glyph is then added to a texture. When a text is going to be rendered, all contained glyphs will be added to the texture when they are needed.
    The actual rendering then in principle renders every character separately using texture coordinates of the glyph and the "big character map" texture.

    This is the cause why read order is not yet considered correctly and the partial string reversal could be a temporary workaround.

    The workaround wouldn't work for Arabic, because there letters are different if they are combined differently. This means "A B" looks different then "AB" or the 'a' inside "ab" might look different to the 'a' inside "ac". (Correct me if I'm wrong).

    Now what should we do now?

    One possible solution would be DirectWrite (available through SharpDX), which allows drawing any text correctly, LTR, RTL and mixed cases are fine. We could replace the current implementation of FontAssetCore by a DirectWrite text renderer, which then either renders directly to render target, or we need to take the way over a Texture that then will be rendered into scene.

    @Stéphane Lenclud , you wrote in another thread that you have experience with graphic coding, what do you think how we should handle text rendering in future inside MP2? Could the explained rendering of characters be a cause for a performance bottleneck? Would be my proposal a bottleneck?

    Finally this means a big rework of one central part of rendering engine that requires much work for developing, testing, and fixing. But I think we would benefit of this step.
     
    • Informative Informative x 2
  11. velis
    • Premium Supporter

    velis MP Donator

    Joined:
    July 16, 2009
    Messages:
    237
    Likes Received:
    25
    Location:
    Radovljica
    Ratings:
    +37 / 0
    Home Country:
    Slovenia Slovenia
    I have a bit of experience with farsi in my Android app:
    Generally, RTL users *prefer* everything to be mirrored, but they are used to western layouts and don't complain about them too much. My farsi translator told me multiple times that I needn't bother that much, but was still quite happy that I went so far as to mirror the entire app.

    In my experience, straight mirror will usually do it (also relatively easy to support in rendering engine), but there may be cases where that's not a good solution. I have no idea what such cases might be, but Google specifically mentions that they don't want to do the straight mirror because it might break something. My guess is that if there was something to break, it would be the developer's LTR assumption and manual layout of components in LTR order. Mirroring certain component combinations might then prove to be a bad idea, but not much worse than not mirroring at all.

    As for string reversing: don't do it!!! Even in RTL languages, there are expressions / acronyms / formulas / whatever that are written in a western-like script. The default Windows API should normally take care of proper string rendering, as long as you use a font that has the required language characters.

    Personally, I think there needs to be one more item observed: current layout engine only supports fixed coordinates. The problem is that some languages require more space to say the same thing than others. So in my translation of MP, I have noticed repeatedly that my translation would be cut off because there simply was no translation short enough. In other places though, there was too much space left because slovene translation was much shorter than english original. This is perhaps unrelated, but essentially it has the same roots as RTL support.

    Oh, and BTW: some languages have different glyphs for numerals (0 - 9). They are also in different unicode code ranges. Just a heads-up for all those %d sprintfs :)

    About FreeType rendering issues: http://stackoverflow.com/questions/6431624/freetype-support-for-right-to-left-languages (there's a layout lib mentioned there)
     
    Last edited: October 22, 2014
    • Thank You! Thank You! x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!