-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
Add method to return random languages (ISO-639 data) #2622
Comments
Thank you for your feature proposal. We marked it as "waiting for user interest" for now to gather some feedback from our community:
We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements. We will start the implementation based on:
We do this because:
|
compare #1548 (requesting full language names) |
I would probably put it in the location module. Also we should probably close #1548 (as superseded by this), as this has a better description. |
The codes like "en" are not locale dependent so they should be in fakerbase The language names are locale dependent however. So it would probably be two methods? faker.location.languageCode() and faker.location.language() |
I thought about using something like As for the Reason being, that some language selection dropdowns show the name, but internally use the code in their data. |
I'd still make it two methods for consistency with .country() and .countryCode() Anyway I agree with closing #1548 to keep discussion and upvotes in one place |
I added this to our meeting notes for discussion:
|
Note that only a small number of languages have a 2 character code. Many more have a three character code. |
Preliminary Team Decision
|
Clear and concise description of the problem
I am currently working on a project where I would like to return a random ISO-639 code in mock data. It would be great for faker to support this internally similar to
location.countryCode
Suggested solution
I'm not sure which module it may fit in well today, or if a new module may make the most sense, but my proposal would be to add a
language
orlanguageCode
method within faker. The method would take as input avariant
based on the ISO-639 standard, defaulting to ISO-639-1 (2 character) codes when called without parameters.Link to the standard: https://www.loc.gov/standards/iso639-2/php/code_list.php
The variants I propose to be implemented are:
639-1
- to return639-1
2 character codes639-2
- to return639-2
3 character codesThe additional sets -
639-3
,639-4
,639-5
- may also be implemented. Similarly, the English, French, and German language names as defined in the standard could be added as variants.Alternative to the specific sets, an
alpha-2
andalpha-3
variant approach could be taken wherealpha-2
would be the 639-1 code set andalpha-3
may be the 639-2 set.Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: