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

Return true or false based on whether the `lang()` did its job #1108

Closed
icambron opened this Issue Sep 17, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@icambron
Copy link
Member

icambron commented Sep 17, 2013

Currently, the user has no way to know if lang("gobbledygook") worked. We should return true or false.

@icambron

This comment has been minimized.

Copy link
Member Author

icambron commented Sep 17, 2013

Actually, given #1109, this should return the language it actually used.

@mj1856

This comment has been minimized.

Copy link
Member

mj1856 commented Sep 18, 2013

Agreed. If the lang is found, it should return it. Otherwise return undefined.

It might also be nice to pass an array of languages in order of precedence:

var lang = moment.lang(['fr-ca','fr','en']);

This allows a fall-back strategy if the language is not found or installed.

I can see this being very useful when the language code is coming from some other system, and the caller isn't sure if the language will be allowed by moment or not.

@icambron

This comment has been minimized.

Copy link
Member Author

icambron commented Sep 18, 2013

Re: fall-back, take a look at #1109, although I suppose we could do both. Edit: and we should since the final backup might not be the current language.

@icambron

This comment has been minimized.

Copy link
Member Author

icambron commented Oct 4, 2013

Closed by #1142

@icambron icambron closed this Oct 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.