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

da-DK license plates #3010

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

da-DK license plates #3010

wants to merge 5 commits into from

Conversation

woller
Copy link

@woller woller commented Oct 14, 2024

Motivation / Background

This Pull Request has been created because it was not possible to generate valid Danish license plates. It adds the simplest possible license plates consisting of 2 letters and 5 digits. It follows the rules laid out on the Danish Wikipedia.

Additional information

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • Tests and Rubocop are passing before submitting your proposed changes.

If you're proposing a new generator or locale:

  • Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.
  • You've reviewed and followed the Contributing guidelines.

lib/locales/da-DK.yml Outdated Show resolved Hide resolved
test/test_da_dk_locale.rb Outdated Show resolved Hide resolved
@stefannibrasil
Copy link
Contributor

Could you also add screenshots of using this in the console (bundle exec rake console)? Thanks!

@woller
Copy link
Author

woller commented Oct 18, 2024

image

Comment on lines +568 to +569
vehicle:
license_plate: '[A-Z]{2}[0-9]{5}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just remembered that the generator for license_plate uses the numerify and letterify helpers by default:
https://github.com/faker-ruby/faker/blob/46130d9212932c5ad3e5523413ef2189937f55af/lib/faker.rb#L53 and

The other locale files use these helpers for generating random numbers and letters (including the vehicle english version). Let's follow the pattern for consistency:

Suggested change
vehicle:
license_plate: '[A-Z]{2}[0-9]{5}'
vehicle:
license_plate: '??#####'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @woller just checking in on the comment above. Apologies for missing the helper in the first place. Thank you!

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

Successfully merging this pull request may close these issues.

3 participants