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

Add the ability to fallback to a primary locale #17

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

Conversation

agustin
Copy link

@agustin agustin commented Nov 14, 2024

Hi @cyril thanks for the work on this gem!

I'm opening this PR, but not sure if this is something that you would be interested to add into the gem. The idea of this change is to be able to fallback to a primary language locale if an extra argument is passed to the .match method, and in that case if all the preferred locales doesn't match with the available locales, a last attempt is made to match a primary locale.

Let me know if you have any concerns or comments about it!
Many thanks!

context "when Chinese is available" do
let(:available_langtag) { "zh" }

it { expect(best_match).to eq "zh" }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the case that's being handle by this change

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.

2 participants