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

Support for rfc 5646 #572

Open
jsamr opened this issue Aug 22, 2016 · 7 comments
Open

Support for rfc 5646 #572

jsamr opened this issue Aug 22, 2016 · 7 comments

Comments

@jsamr
Copy link

jsamr commented Aug 22, 2016

Similarly to isISO8601, isRFC5646 will check if the given string param complies with the rfc 5646 standard for localisation tags (ex: fr-CA).

@chriso
Copy link
Collaborator

chriso commented Sep 10, 2016

Happy to accept a PR 😄

@Haroenv
Copy link

Haroenv commented Jun 7, 2017

How could this be done without having a complete list of languages in the library?

@profnandaa
Copy link
Member

@jsamr - you can help here?

@jsamr
Copy link
Author

jsamr commented Sep 25, 2018

@profnandaa Sorry don't have the time for this. Perhaps later this year.

@profnandaa
Copy link
Member

profnandaa commented Sep 25, 2018 via email

@lin826
Copy link

lin826 commented Oct 19, 2020

How could this be done without having a complete list of languages in the library?

Like the question from @Haroenv, we do need a complete list of IANA Language Tags.
Using their JS API might be a compromised solution.

I propose this:
Step 1. npm install their API, which has no string assertion.
Step 2. Add a file of isLanguageTag.js:

import tags from 'language-tags';

// Reference: https://tools.ietf.org/html/rfc5646
export default function isLanguageTag(str, options) {
    assertString(str);

    return tags.check(str)
}

Step 3. Add some tests from RFC 5646.

@Haroenv
Copy link

Haroenv commented Oct 19, 2020

the project you linked still uses a full list of all languages, here: https://github.com/mattcg/language-subtag-registry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants