elixir-cldr / cldr

Elixir implementation of CLDR/ICU
Other
440 stars 33 forks source link

Character Direction attribute for languages/scripts. #196

Closed Doerge closed 1 year ago

Doerge commented 1 year ago

Hi,

I want to render right-to-left (rtl) languages properly in my frontend with the css direction property. My content is dynamic: I have the language code, but I need to figure out if it is rtl or not. I hoped to find that data somewhere in ex_cldr_language, but after digging around a bit, I think it's not available in that repo, because it's not available here.

I tried looking for this data elsewhere, but it's not in BCP47 (that this repo already uses) or in https://en.wikipedia.org/wiki/ISO_15924. I found it in CLDR Json repository, but ex_cldr uses CLDR repository where I can't find it 😅

Do you think it is viable to work this feature into this project, or is it outside the scope and should live in another project?

kipcole9 commented 1 year ago

@Doerge thanks for the issue. Definitely in scope. And you're right, its not easy to track down in the CLDR repository (I haven't found it yet). However since the cldr-json repository is generated from cldr (and I also do the same under the covers) it must be there somewhere and I just have to find it.

I am due to release a beta of ex_cldr version 2.37.0 based upon CLDR 43 by the end of this week and I will make sure to include language direction in it somehow.

Doerge commented 1 year ago

Found it now in the CLDR Repo by ripgrepping it locally. Githubs search is broken. The repo is too big. It is in common/main/ar.xml

    <layout>
        <orientation>
            <characterOrder>right-to-left</characterOrder>
        </orientation>
    </layout>
kipcole9 commented 1 year ago

Yep, found the same. As of commit 3fd958833 the layout info (text direction, line direction) are added to the locale files. The API to expose these data is not yet in place - coming up next.

kipcole9 commented 1 year ago

Thanks for the collaboration and suggestion. This will ship with the next version of ex_cldr that will be in release candidate form by the end of this week.

Doerge commented 1 year ago

You're amazing Kip! Thanks so much for maintaining these important packages for the community!

florianb commented 1 year ago

Fantastic!