Skip to main content
All CollectionsLanguage and Internationalization
Changing address field ordering by locale
Changing address field ordering by locale

Some countries format addresses differently

Michael Fatica avatar
Written by Michael Fatica
Updated over 2 years ago

Some country's mailing standards include variations on address field ordering and formatting.

Some countries place the postal code before the city, others after. Some include commas, others hyphens and so on.

To account for these address formatting differences, a combination of MetaLocator's field templates and language files can be leveraged.

First, update the "Full Address" field to use the International template as shown below:

Once that change is made, the system will use the LOCATOR_ADDRESS_FORMAT Language constant to control the field ordering.

The default value is:

LOCATOR_ADDRESS_FORMAT="%1$s %2$s %3$s, %4$s %5$s"

This arranges the address components in the US standard order of

  1. address

  2. address2

  3. city

  4. state

  5. postalcode

The numbered placeholders can be re-arranged to control custom placement for international formatting requirements. For example, to place the postal code before the city, state output, the language constant should be updated as follows:

LOCATOR_ADDRESS_FORMAT="%1$s %2$s %5$s %3$s, %4$s"

Notice that the %5$s placeholder for the postal code has been moved before the city - an address format found in Brazil, Mexico, Italy and other countries.

Did this answer your question?