Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow locale to be a list #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benjaminwinger
Copy link

This allows an arbitrary-length of fallback chain for the user-requested locale, letting users provide multiple preferred languages instead of just one.

@benjaminwinger benjaminwinger force-pushed the fallback-chains branch 2 times, most recently from 3a34e20 to 5a41912 Compare February 1, 2022 22:53
This allows an arbitrary-length of fallback chain for the user-requested
locale.
@benjaminwinger
Copy link
Author

Updated to include tests.

Note that I removed the following test, as there doesn't seem to be a meaningful result for it with arbitrary length fallback chains, and I'm not sure that it's necessary in the first place (en should generally only contain messages which are shared between the country-specific locales, and users should usually request a country-specific locale).

it("returns the fallbackLocale ancestry if locale is parent of fallbackLocale", function()
     assert.same(variants.fallbacks('en','en-US'), {'en-US', 'en'})
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant