KContacts

Localized Address Formats

Address formats can be a tricky thing. KContacts tries very hard to perfectly fit the needs of ~95% of users and to be at least sufficient for the other 5%.

The formatting of an address depends on the destination country as well as on the origin country of a letter. Basically, the part indicating the destination country follows the rules of the country of origin, all the rest follows the rules of the destination country. So we need to store for every country a) the country positioning and b) the address formatting.

Address formats should usually be stored in a country's entry.desktop. There we store the country position in field "AddressCountryPosition" and the address format in a field "AddressFormat". Note that for most countries one field "AddressFormat" is sufficient for personal as well as company addresses (because personal addresses look just like business addresses without company); however, in some countries (eg. Hungary) business addresses differ in their structure. In this case you have the possibility of adding another field "BusinessAddressFormat" which will be preferred for formatting of business addresses; if KContacts can't find such a field, it will fall back to "AddressFormat". (Please use BusinessAddressFormat ONLY if you really need to)

The format consists mainly of tags that will be replaced by address fields. The list of tags may grow in the future, the format might change in the near future, but I hope not.

Any comments very very welcome to kde-p[email protected][email protected][email protected]de.or[email protected]g or to [email protected][email protected]sche[email protected]nck.d[email protected]e.

-Jost.

Fields AddressFormat and BusinessAddressFormat

1 %n = real name
2 %N = REAL NAME
3 %cm = company
4 %CM = COMPANY
5 %s = street
6 %S = STREET
7 %z = zip code
8 %l = location
9 %L = LOCATION
10 %r = region
11 %R = REGION
12 %p = post office box
13 %, = conditional comma+whitespace,
14  will be left out if the value left or right of it is purged
15 %w = conditional whitespace,
16  will be left out if the value left or right of it is purged
17 %0(...) = the text inside the brackets will be completely purged if not
18  at least one tag inside it evaluates to something. Example: when the
19  address doesn't have a postbox, the string %0(PO Box %p) will not
20  evaluate to "PO Box " but to an empty string.
21 \n = newline

Field AddressCountryPosition

1 below = country name below rest of address
2 BELOW = country name below in capital letters
3 above = country name above rest of address
4 ABOVE = country name above in capital letters

Some Tips

  • You sometimes have three fields in a line which can all be empty. If you eg. separate them all with conditional whitespace (same goes for cond. comma) like in "%z%w%r%w%l" and only the middle value (here: region) is empty, there will be no whitespace at all between the outer values (here: zipcode and location). To avoid this, combine two of these values with purge brackets: %0(zwr)wl.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Jun 20 2021 22:54:52 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.