XAMPPRocky/fluent-templates

Fallback chain for sibling specificity in languages

Open

#37 aperta il 8 ago 2022

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)Rust (38 fork)auto 404
enhancementhelp wanted

Metriche repository

Star
 (167 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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 https://github.com/XAMPPRocky/fluent-templates/issues/35#issuecomment-1142315448

Guida contributor