Closed valkum closed 2 years ago
Thank you for your PR! This looks good to me, but it looks like it's failing the tests.
Sry for the delay.
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.
cc @zbraniecki Would you happen to have advice / opinion on how to handle the above?
Thank you for your PR, and congrats on your first contribution! 🎉
I'm going to merge this as is and open a new issue for the other fallback chain issues.
Closes #1
Instead of using the computed fallback chain, lookup_complete for the two loaders will now use an ordered list of matching languages. This allows to overwrite translations for languageIds with higher specifier. e.g. have a baseset in en, and differences for en-GB in en-GB