XAMPPRocky / fluent-templates

Easily add Fluent to your Rust project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fallback chain for sibling specificity in languages

XAMPPRocky opened this issue · comments

So basically going for the proposed solution from #1 this results in the fallback key to be present in the base zh language.

I am not sure if we should change that to have a resolution order like:
zh-CN -> zh-CN, zh-TW, zh, default_fallback

The question then would be: What to do with a specificity higher than 2?
de-DE-1996 -> de-DE-1996, [de-CH-VARIANT], de-DE, de-CH, de, default_fallback?
Not sure how the best approach should be.
If we consider the current state as a linked list, other language regions like CH would then be siblings in a tree.
The question is how many branches of the main path between the requested one and the root should be visited.

fallback <- de <- de-DE <- de-DE-1996
               Î         ^- de-DE-VARIANT2          
               \ de-CH <- de-CH-VARIANT

In which order should they be visited?

And what about multiple requested languages? (possibly with weights), can we ignore them for now? I guess currently one can argue that this is only localization resolution and language negotiation should be done ahead.

Originally posted by @valkum in #35 (comment)