globalizejs / globalize

A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
https://globalizejs.com
MIT License
4.8k stars 605 forks source link

Introduce a new module for basic Bidi functions that matches ICU4C & ICU4J #862

Open amrdarwish1975 opened 5 years ago

amrdarwish1975 commented 5 years ago

For many years ICU4C & ICU4J have supported Bidi language. And with the massive strike of web app era (mainly through JavaScript) the need is no more optional to gather all JS based needed work by Web Apps or any JS based apps in one module (to support Bidi) under the most relevant one which is globalizejs.

In the following is an overview of what will be done under such new module.

Bidirectional Text Support

What is bidirectional text? Basically, as the name implies, text that flows left-to-right (LTR) and right-to-left (RTL). The writing begins at the right-hand side of the page, and concludes towards the left.

What is bidirectional text (or script) support? The capability of a computer system to correctly handle the input, processing, display and storage of bi-directional text. The term bidirectional is often shortened to BiDi or bidi (pronounced "bye-dye").

Why is Bidi text support important to IBM? We market our products globally, including the 500+ million people who use bidi scripts on a daily basis. Note this does not necessarily mean having a translated user interface (UI) - the UI may be in English. However, the product must enable a user to enter bidi text, and process, display, and store bidi text, without corruption. Thus, even though the product uses an English UI, IBM products must be able to fully support bidi text, and enable mixing both LTR and RTL text on the same page.

Which languages use bidi scripts?
Arabic and Hebrew, and their derivatives, namely, Persian, Urdu and Yiddish. Note that products do not have to be running in a country where bidi script languages are spoken - products supporting bidi text may be used in any country, in any culture.

How do I support bidi text in my application? Use Unicode, which provides the foundation for bidi support, with rules on how mixed left-to-right and right-to-left text is to be encoded and displayed. The Unicode standard calls for characters to be ordered in "logical sequence" - that is, the sequence in which characters are read, or written. Secondly, use APIs from libraries such as ICU (International Components for Unicode) which ease the burden of handling text from multiple scripts.

Which main features we need to support?

  1. Arabic numeric shaping.
  2. Base text direction.
  3. Structural text support
amrdarwish1975 commented 5 years ago

@rxaviers Your kind action to review proposal per current issue is highly appreciated?

rxaviers commented 5 years ago

Thanks for the reminder! Please, can you explain how your proposal is different from the below? I want to double check what from your goal we have covered and what's missing. Thanks

ieugen commented 5 years ago

Hi,

My feedback (after skimming through the issues) is that this one explicitly mentions compatibility with the other ICU implementations out there. Consistency is good. Also this issue sparked a discussion and added to documentation (by pointing to the other issues and solutions) - a win in my book.

Thank you both.