Warning, /frameworks/kcontacts/docs/AddressFormat.md is written in an unsupported language. File is not indexed.

0001 # Localized Address Formats
0002 
0003 KContact's address formatting largely follows the approach taken by
0004 [libaddressinput](https://github.com/google/libaddressinput), with adding
0005 a few additional fields and formatting styles.
0006 
0007 Address formatting rules are specified in the `addressformatrc` file in the `src`
0008 directory, grouped by country. The formatting rules format is compatible
0009 with [that of libaddressinput](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
0010 
0011 ## Address Format Information
0012 
0013 * AddressFormat: the default address format using native script, using the placeholders
0014   specified below (mandatory).
0015 * LatinAddressFormat: for countries using a non-latin script this can provide
0016   an alternative format for addresses transliterated to a latin script (optional).
0017 * BusinessAddressFormat: used for formatting postal addresses of an organization.
0018   This only needs to be specified if the format differs from the generic case.
0019 * LatinBusinessAddressFormat: see LatinAddressFormat.
0020 
0021 All of the above values may be specified in multiple variants for multi-lingual countries.
0022 This is typically only needed when the format rule contains literal strings, e.g.
0023 for specifying a post office box.
0024 
0025 * Required: The address fields that are minimally required to form a valid address
0026   in this country.
0027 * Upper: The address fields to be formatted in upper case regardless of the input
0028   for postal addresses.
0029 
0030 The above values are specified as a string containing the single letter address field
0031 identifiers listed below. E.g. "AZC" would indicate that a street address, postal code
0032 and locality (city) are required.
0033 
0034 * PostalCodeFormat: A regular expression matching all valid postal codes in
0035   this country.
0036 
0037 ## Address Field Identifiers
0038 
0039 The following identifiers are used in the formatting rules to refer to specific
0040 parts of an address:
0041 
0042 * N - Name of a person/Recipient of a letter
0043 * O - Organization
0044 * A – Street address
0045 * C – Locality (city)
0046 * S – Region (country subdivision/administrative area/state/etc)
0047 * Z – Postal code/zip code
0048 * R - Country
0049 
0050 Identifiers used by libaddressinput but not by KContacts:
0051 
0052 * D – Dependent locality (may be an inner-city district or a suburb)
0053 * X – Sorting code
0054 
0055 ## Address Formatting Rules
0056 
0057 Address formatting rules consist of a sequence of elements of the following
0058 three types:
0059 * Fields - Insert the value of the corresponding address field, specified as a `%` sign
0060   followed by a field identifier (see above).
0061 * Separators - Represented as `%n`. Depending on the formatting style those are replaced
0062   e.g. a line break or a script-dependent separator string.
0063 * Literals - Any other string. Inserted as-is in the output, given it is neither preceded nor
0064   followed by an empty field.