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

Add support for generating Roman Numerals #2649

Closed
matthewmayer opened this issue Feb 8, 2024 · 14 comments · Fixed by #3070
Closed

Add support for generating Roman Numerals #2649

matthewmayer opened this issue Feb 8, 2024 · 14 comments · Fixed by #3070
Assignees
Labels
c: feature Request for new feature m: number Something is referring to the number module p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Milestone

Comments

@matthewmayer
Copy link
Contributor

matthewmayer commented Feb 8, 2024

Clear and concise description of the problem

It would be useful to be able to generate roman numerals, e.g. for sections of a fake document, or as a fake pattern to be used in another pattern like "Super Bowl XXVII".

Suggested solution

faker.number.romanNumeral({min:1, max: 100}) //XVII

min would default to 1 (you can't write 0 in roman numerals). max would probably be limited to 4999 as roman numerals are not as well-defined above 5000.
Maybe lowercase/uppercase options?

Not localizable. Since roman numerals are always written in latin script.

Alternative

write custom conversion code eg.

convertToRomanNumerals(faker.number.int({min:1, max:4999}))

where convertToRomanNumerals is a suitable implementation from https://stackoverflow.com/questions/9083037/convert-a-number-into-a-roman-numeral-in-javascript

Additional context

No response

@matthewmayer matthewmayer added c: feature Request for new feature s: pending triage Pending Triage s: waiting for user interest Waiting for more users interested in this feature labels Feb 8, 2024
Copy link
Contributor

github-actions bot commented Feb 8, 2024

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community:

  • If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
  • If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.

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:

  • the number of votes (:+1:) and comments
  • the relevance for the ecosystem
  • availability of alternatives and workarounds
  • and the complexity of the requested feature

We do this because:

  • There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
  • Every feature we add to faker has "costs" associated to it:
    • initial costs: design, implementation, reviews, documentation
    • running costs: awareness of the feature itself, more complex module structure, increased bundle size, more work during refactors

View more issues which are waiting for user interest

@ST-DDT ST-DDT added p: 1-normal Nothing urgent m: string Something is referring to the string module m: number Something is referring to the number module and removed s: pending triage Pending Triage labels Feb 24, 2024
@ST-DDT ST-DDT added this to the vFuture milestone Feb 24, 2024
@WikiRik
Copy link

WikiRik commented Mar 1, 2024

Would indeed be interesting at times to have this. I personally see no need for numerals above 4999 or lowercases ones. Min/max is indeed good to have.

@AmaanRS
Copy link
Contributor

AmaanRS commented Aug 17, 2024

Should i implement this feature ?

@matthewmayer
Copy link
Contributor Author

Should i implement this feature ?

We normally wait until a feature has 10 GitHub upvotes. It's nearly there 😀

@ST-DDT
Copy link
Member

ST-DDT commented Aug 17, 2024

@AmaanRS Do you need roman numerals by string length (range) or by value range?

@AmaanRS
Copy link
Contributor

AmaanRS commented Aug 18, 2024

Yes, I need it by value range (eg: from 1 to 100)

@ST-DDT
Copy link
Member

ST-DDT commented Aug 18, 2024

@AmaanRS Could you please describe your usecase? What will you use the output of the method for?

@AmaanRS
Copy link
Contributor

AmaanRS commented Aug 19, 2024

I have to number the recipe in cookbook by roman numbers, and for that function i am writing tests, which needs random roman numbers

@AmaanRS
Copy link
Contributor

AmaanRS commented Aug 19, 2024

So..., should i create it ?

@matthewmayer
Copy link
Contributor Author

So..., should i create it ?

Since there are now 10 upvotes, I think you could go ahead and start working on it to aid with discussion. Be sure to read the Contributing guide for advice.

Be aware it will likely take some time to review and merge as the maintainers are busy getting v9 ready for release.

@AmaanRS
Copy link
Contributor

AmaanRS commented Aug 20, 2024

So should i create a function named convertToRomanNumerals or a function on the property number named romanNumeral

@ST-DDT
Copy link
Member

ST-DDT commented Aug 20, 2024

Please create a function in the number module, so that you can call it like this:

faker.number.romanNumerals()

@ST-DDT ST-DDT removed s: waiting for user interest Waiting for more users interested in this feature m: string Something is referring to the string module labels Aug 20, 2024
@ST-DDT ST-DDT modified the milestones: vFuture, vAnytime Aug 20, 2024
@matthewmayer
Copy link
Contributor Author

Maybe singular romanNumeral rather than plural romanNumerals

@AmaanRS
Copy link
Contributor

AmaanRS commented Aug 22, 2024

@ST-DDT I have written the function (draft) #3070

@ST-DDT ST-DDT linked a pull request Oct 17, 2024 that will close this issue
@ST-DDT ST-DDT added the s: accepted Accepted feature / Confirmed bug label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature m: number Something is referring to the number module p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants