Skip to content

Commit

Permalink
Move en-US.yml's cell_phone entry to the correct position (#2924)
Browse files Browse the repository at this point in the history
`PhoneNumber.cell_phone` expects an i18n key of `cell_phone.formats`,
but the en-US.yml file currently has `faker.phone_number.cell_phone`
instead of `faker.cell_phone`.

The result of that mismatch is that `cell_phone` will ignore the defined
formats, and potentially generate invalid US numbers (e.g. those with an
area code beginning with 1) when the locale is en-US.

31d99d1 reworked YAML structure and
appears to have inadvertently moved the key.

You can see the change in US number behavior in a console:

  Faker::Config.locale = "en-US"
  Faker::PhoneNumber.translate("faker.cell_phone.formats")

On 3.3.0 this returns

  ["###-###-####", "(###) ###-####", "###.###.####", "### ### ####"]

because it's the fallback value within the `en` (not `en-US`) locale
file. The correct value should be the formats outdented in this commit.
  • Loading branch information
aprescott authored Mar 28, 2024
1 parent 3c85321 commit e15e606
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6949,16 +6949,16 @@ en-US:
- "(#{PhoneNumber.area_code}) #{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number} x#{PhoneNumber.extension}"
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number} x#{PhoneNumber.extension}"
- "#{PhoneNumber.area_code}.#{PhoneNumber.exchange_code}.#{PhoneNumber.subscriber_number} x#{PhoneNumber.extension}"
cell_phone:
formats:
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "(#{PhoneNumber.area_code}) #{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}.#{PhoneNumber.exchange_code}.#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "(#{PhoneNumber.area_code}) #{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}.#{PhoneNumber.exchange_code}.#{PhoneNumber.subscriber_number}"
cell_phone:
formats:
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "(#{PhoneNumber.area_code}) #{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}.#{PhoneNumber.exchange_code}.#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "(#{PhoneNumber.area_code}) #{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}-#{PhoneNumber.exchange_code}-#{PhoneNumber.subscriber_number}"
- "#{PhoneNumber.area_code}.#{PhoneNumber.exchange_code}.#{PhoneNumber.subscriber_number}"
id_number:
valid: "#{IdNumber.ssn_valid}"
invalid:
Expand Down

0 comments on commit e15e606

Please sign in to comment.