Skip to content

Rewrite the address formatter

This replaces our existing formatting rule system with one closely resembling that of libaddressinput. This has several advantages:

  • Significantly expanded country coverage (192 vs. 35) thanks to compatibility with the libaddressinput format
  • Support for multiple formatting styles, rather than just the postal style. This will allow the removal of various sub-optimal application workarounds which "reformat" the previous output to get something nicer for displaying.
  • Support for both native scripts and Latin transliterations.
  • We don't need the convoluted conditional field handling anymore, the libaddressinput algorithm is able to automatically detect when literal elements need to be included.

Compared to libaddressinput this has a number of additions to retain previous functionality, or further expand it:

  • Support for post office boxes and international addresses.
  • Support for dedicated business format rules.
  • Automatic script detection based on the address input.
  • Reordering of multi-line street data for formats using reverse ordering.

This also contains the preparation for making the address format meta data available in public API. This has mainly two use-cases:

  • Allow address editors to adapt to the corresponding country and validate address input according to local rules.
  • Support textual address parsing code.

All new API is also already prepared for direct consumption from QML without the need for wrappers.

Merge request reports