Skip to content

Introducing district and subdistrict field labels and error strings#496

Open
ananyaneogi wants to merge 3 commits into
mainfrom
add-district-field
Open

Introducing district and subdistrict field labels and error strings#496
ananyaneogi wants to merge 3 commits into
mainfrom
add-district-field

Conversation

@ananyaneogi
Copy link
Copy Markdown
Member

@ananyaneogi ananyaneogi commented May 22, 2026

What are you trying to accomplish?

Add support for district and subdistrict as address fields, enabling regions to collect and validate these address components. This is needed to support address formats in countries where district and subdistrict are meaningful parts of a postal address (e.g., Brazil, Philippines, Kuwait, Peru).

Also cut a new minor version.

What approach did you choose and why?

district and subdistrict were added following the same pattern already established by neighborhood, street_name, etc -

  • Both fields are added as attributes on the Address class with reader accessors and constructor parameters.
  • Both are registered in Field as recognized field keys.
  • Translations for validation error/warning messages are added

What should reviewers focus on?

Are the changes sufficient to introduce new error translations and labels to clients?

The impact of these changes

Consumers of this gem can now use district and subdistrict address fields with full label and validation message support. Existing addresses without these fields are unaffected, as both default to nil.

Testing

New tests cover:

  • Initializing an Address with district and subdistrict and reading their values back.
  • Verifying that format correctly fills {district} and {subdistrict} placeholders in additional lines.
  • Confirming that nil is the default for both fields when omitted.
  • Asserting correct error messages for district and subdistrict across BR, KW, PE, and PH.
  • Asserting correct labels for district and subdistrict across multiple locales and countries.
Screenshot 2026-05-22 at 5 44 45 PM

Checklist

  • I have added a CHANGELOG entry for this change (or determined that it isn't needed)

@ananyaneogi ananyaneogi marked this pull request as ready for review May 22, 2026 21:46
@ananyaneogi ananyaneogi requested a review from rochlefebvre May 22, 2026 21:46
Comment thread data/regions/KW/en.yml
Comment thread data/regions/KW/en.yml
Comment thread data/regions/PH/en.yml
Comment thread data/regions/PH/en.yml
Comment thread data/regions/_default/en.yml
Comment thread data/regions/_default/en.yml
Comment thread data/regions/_default/en.yml
@ananyaneogi ananyaneogi force-pushed the add-district-field branch from 5c98514 to 1247448 Compare May 22, 2026 22:23
Comment thread data/regions/PE/en.yml Outdated
Comment thread data/regions/PE/en.yml Outdated
@ananyaneogi ananyaneogi force-pushed the add-district-field branch from 1247448 to de24ab0 Compare May 22, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant