kellpossible / kellpossible/cargo-i18n

i18n-embed: Regionless languages (Esperanto)

Open
#52 11 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
146
Forks
41
Avg merge
12d 14h
Merged PRs (30d)
1

Description

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 `LanguageIdentifier`s?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how i18n-embed discovers language files under the i18n/ directory and how it handles LanguageIdentifier values. Reproduce the issue with an eo/ directory alongside the logged de-DE, en-US, and ja-JP cases, then add coverage showing that Esperanto is detected without a region; done means regionless locales load successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
internationalization, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.