Draft: Country Address Formatting API - #589
Draft
DominiqueFlaaa wants to merge 1 commit into
Draft
DominiqueFlaaa wants to merge 1 commit into
DominiqueFlaaa wants to merge 1 commit into
Conversation
Add TypeScript API to fetch country-specific address formatting details: - getCountryFormatting(countryCode, locale) function - Complete type definitions for formatting, zones, labels - Dynamic imports for optimal bundle size - Stub data for CA (en/fr) and BR (en/pt-br) - Documentation and usage examples The API provides: - Address templates (edit/show formats) - Required field flags per country - Political subdivisions (states/provinces) - Localized field labels - Postal code patterns Pure static/open-source design with no internal Shopify references. Assisted-By: devx/2eb803a0-055a-45fe-b145-0b64ab96592e
najibna
reviewed
Sep 21, 2026
najibna
left a comment
There was a problem hiding this comment.
Reasonable draft shape for a country formatting API.
hasCountryFormatting still loads the full JSON, and getAvailableLocales is a hardcoded stub. Also, DRAFT_PR_SUMMARY.md at the repo root should not ship.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft: Country Address Formatting API
Summary
This PR introduces a new TypeScript module in the
lang/typescriptpackage that provides a public API for fetching country-specific address formatting details.What's New
API Functions
getCountryFormatting(countryCode, locale)- Fetch complete formatting details for a country/localehasCountryFormatting(countryCode, locale)- Check if formatting data existsgetAvailableLocales(countryCode)- Get available locales for a countryType Definitions
CountryFormatting- Complete country formatting objectAddressFormat- Edit and show templatesAddressFormatExtended- Extended formatting with separatorsAdditionalAddressFields- Required field flags per countryZone- Political subdivisions (states/provinces)AddressLabels- Localized field labelsFeatures
Data Organization
Example Usage
Country Differences Demonstrated
The stub data shows key differences between countries:
Canada (CA):
address1andaddress2fieldsBrazil (BR):
streetName+streetNumberneighborhoodfieldline2for complementFiles Changed
lang/typescript/src/index.ts- Exports new APIlang/typescript/src/country-formatting.ts- Main API modulelang/typescript/src/country-formatting.md- Documentationlang/typescript/src/country-formatting.example.ts- Usage exampleslang/typescript/src/types/country-formatting.ts- Type definitionslang/typescript/src/data/CA/en.json- Canadian English datalang/typescript/src/data/CA/fr.json- Canadian French datalang/typescript/src/data/BR/en.json- Brazilian English datalang/typescript/src/data/BR/pt-br.json- Brazilian Portuguese dataNext Steps
zip_regexpatternsNotes