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

Date.php: Silently fall back to en when the locale isn't supported #182

Closed
wants to merge 1 commit into from

Conversation

zhaofengli
Copy link

Currently, a fatal error occurs when the program tries to setLocale() to an unsupported one (e.g. ta). Maybe we should silently fall back to en in such situation.

@danhunsaker
Copy link

I think I'd prefer to have a non-fatal Exception in this case, to alert me that the locale isn't available during development. It'd be better than a fatal error because I could handle the issue myself in my own code in whatever way makes sense for my project, especially if I allow users to specify their own locales. I may want to fall back to something other than English, for example.

At the very least, a fatal error isn't a good thing in any case.

@jenssegers
Copy link
Owner

I would rather have a setFallback or setFallbackLocale so that people can choose to enable this functionality. Could also make it use 'en' by default, but at least people have a way of changing the fallback this way :)

@danhunsaker
Copy link

In that case, setFallbackLocale is probably the better bet, name-wise, in case other fallbacks are introduced for other things later on. A default fallback does seem wise, though, given the fatal error we get otherwise.

@zhaofengli
Copy link
Author

Great! Adding that.

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.

None yet

3 participants