cargo-i18n icon indicating copy to clipboard operation
cargo-i18n copied to clipboard

i18n-embed: Regionless languages (Esperanto)

Open fosskers opened this issue 5 years ago • 11 comments

I have software that is localized into, among others, Esperanto. The official Esperanto language identifier is eo without any region (like the -US in en-US). unic_langid can do langid!("eo") just fine, but it seems that having an eo/ directory within the i18n/ dir that i18n-embed expects isn't detected. Turning on logs, I see:

19:21:46 [DEBUG] (1) i18n_embed: Attempting to load language file: "de-DE/aura.ftl"
19:21:46 [DEBUG] (1) i18n_embed::fluent: Loaded language file: "de-DE/aura.ftl" for language: "de-DE"
19:21:46 [DEBUG] (1) i18n_embed: Attempting to load language file: "en-US/aura.ftl"
19:21:46 [DEBUG] (1) i18n_embed::fluent: Loaded language file: "en-US/aura.ftl" for language: "en-US"
19:21:46 [DEBUG] (1) i18n_embed: Attempting to load language file: "ja-JP/aura.ftl"
19:21:46 [DEBUG] (1) i18n_embed::fluent: Loaded language file: "ja-JP/aura.ftl" for language: "ja-JP"

If I change the name to eo-EO (not its real code), i18n-embed can now detect it and I see:

19:17:51 [DEBUG] (1) i18n_embed: Attempting to load language file: "eo-EO/aura.ftl"
19:17:51 [DEBUG] (1) i18n_embed::fluent: Loaded language file: "eo-EO/aura.ftl" for language: "eo-EO"

Looking in my /usr/share/i18n/locales, it seems that eo and i18n are the only two locales given that don't have a region, so it makes sense that this is an edge case. Can i18n-embed be made to support regionless LanguageIdentifiers?

fosskers avatar Dec 05 '20 19:12 fosskers

Now that I think, wouldn't fixing this allow for regionless localizations in general? Say Chinese which has several official zh-* codes.

fosskers avatar Dec 05 '20 19:12 fosskers

Hi there, any thoughts?

fosskers avatar Dec 16 '20 16:12 fosskers

Hi @fosskers sorry for the slow reply, I'll make sure to take a look at this one soon

kellpossible avatar Jan 11 '21 10:01 kellpossible

One of the tests is using ru without a region https://github.com/kellpossible/cargo-i18n/tree/master/i18n-embed/i18n/ftl/ru so something interesting is going on here!

kellpossible avatar Jan 12 '21 19:01 kellpossible

does this problem occur for you with other region-less language identifiers, or only eo?

kellpossible avatar Mar 18 '21 00:03 kellpossible

I haven't tried it with any others, but I could try it, re: https://github.com/kellpossible/cargo-i18n/issues/52#issuecomment-739350079

fosskers avatar Mar 18 '21 01:03 fosskers

@fosskers I'm currently working on an example for this repo that we could modify to reproduce the problem in a test

kellpossible avatar Mar 18 '21 02:03 kellpossible

Perhaps this example could be modified, so the problem is reproduced in a test https://github.com/kellpossible/cargo-i18n/tree/master/i18n-embed/examples/library-fluent

kellpossible avatar Mar 18 '21 02:03 kellpossible

@fosskers I haven't been able to reproduce this problem for myself yet, do you think we should close this issue?

kellpossible avatar Nov 29 '21 16:11 kellpossible

Let's leave it open for now, I'm going to be back developing the project soon that needs it.

fosskers avatar Nov 29 '21 17:11 fosskers

Okay, no worries! We'll leave it open :slightly_smiling_face:

kellpossible avatar Nov 29 '21 18:11 kellpossible