Skip to content
New issue

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

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

Already on GitHub? # to your account

Fallback to default when requested language is missing, rather than panicking #16

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

benjaminwinger
Copy link
Contributor

I'm fairly new to fluent, and in my application I'm setting the requested language id from the user's locale settings, but there's only the one localization at the moment, and it doesn't seem right to have the application panic at runtime if the user's locale differs from the fallback locale.

At the very least I think it should return an error rather than panic, so that it's recoverable, but it seems to me that the requested language not being available is also a situation where the fallback language should be used.

#15 also would help with avoiding the panic, but I think that for most situations it would be sufficient just to use the fallback language, and simpler from the perspective of using the library.

@XAMPPRocky
Copy link
Owner

Thank you for your PR, and congrats on your first contribution! 🎉

@XAMPPRocky XAMPPRocky merged commit 0264258 into XAMPPRocky:master Jul 21, 2020
@XAMPPRocky
Copy link
Owner

XAMPPRocky commented Jul 21, 2020

This has been released as 0.5.12

@benjaminwinger benjaminwinger deleted the missing_languages branch July 22, 2020 00:30
@benjaminwinger
Copy link
Contributor Author

No problem, and thanks for the quick response!

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

Successfully merging this pull request may close these issues.

2 participants