Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Spanish address format

Open
#219 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
localization

Research direction

Start with the linked Spain address-format data and review how libaddressinput handles %n, optional fields, and the admin1 field. Resolve which formatting behavior is intended before changing the format; done means Spanish addresses render the province appropriately when it is present or absent.

Written by the indexing model from the issue text.

Description

The address format for Spain is currently as follows:

"fmt":"%N%n%O%n%A%n%Z %C %S"

It looks wrong to me to have the province (%S) separated by a space. Instead, one of the following changes would make most sense:

  1. Put it in parentheses. That appears to be the more idiomatic formatting, but it seems to make it harder to make the province be optional.
  2. Add an optional field fmt_admin1 which, when present, indicates a format to use for the admin1 field if present. Then set fmt_admin1 to "(%S)" for Spain.
  3. Make it a newline (%n) instead of a space. This is a simple fix that libaddressinput supports and that is also supported by the postal service.

Regarding the first point, out in the wild, a well-formatted Spanish address seems to leave out the province if it's obvious. For example, for the city of Barcelona, one would write Barcelona by itself rather than write "Barcelona (Barcelona)". For that reason, it may be problematic to make the format string as simple as "%N%n%O%n%A%n%Z %C (%S)". When the admin1 is not present, the address would end up with empty parentheses.

Dominant language
C++
Stars
629
Forks
109
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/libaddressinput

All issues in google/libaddressinput

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.