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

Validate AppleLocale against supported locales #33

Merged
merged 5 commits into from
Dec 26, 2018

Conversation

pi0
Copy link
Contributor

@pi0 pi0 commented Dec 16, 2018

Fixes #28, vercel/hyper#3091, and vercel/hyper#2913 (comment).

MacOS defaults read -g AppleLocale returns invalid POSIX values when the locale is different than language, causing values like en_DE or en_IR. Fortunately, we also have /usr/bin/locale -a which returns a list of supported locales.

This PR fixes issue, by validating locale against supporting locales and falling back to the defaultLocale in case of invalid one.


Attachment. Perl warning:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LC_ALL = (unset),
        LANG = "en_DE.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

@pi0 pi0 changed the title fix: validate AppleLocale fix: validate AppleLocale against supported locales Dec 16, 2018
@pi0
Copy link
Contributor Author

pi0 commented Dec 17, 2018

@sindresorhus Tests seem to fail on master too. Opened #34 for it.

index.js Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Can you fix the merge conflict?

@pi0
Copy link
Contributor Author

pi0 commented Dec 26, 2018

@sindresorhus Thanks for time for review. I made changes and also added a comment.

@sindresorhus sindresorhus changed the title fix: validate AppleLocale against supported locales Validate AppleLocale against supported locales Dec 26, 2018
@sindresorhus sindresorhus merged commit 2c5f43f into sindresorhus:master Dec 26, 2018
@pi0 pi0 deleted the fix/appleLocale branch December 26, 2018 19:55
pi0 added a commit to pi0/hyper that referenced this pull request Dec 26, 2018
Stanzilla pushed a commit to vercel/hyper that referenced this pull request Jan 3, 2019
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.

Generating invalid locale
3 participants