B.6. Storing Information in Multiple Languages

If the directory contains a single language, it is not necessary to do anything special to add a new entry to the directory. However, if an organization is multinational, it may be necessary to store information in multiple languages so that users in different locales can view directory information in their own language.
When information in the directory is represented in multiple languages, the server associates language tags with attribute values. When a new entry is added, the attribute values used in the RDN (relative distinguished name, the naming attribute) must be provided without any language codes.
Multiple languages can be stored for a single attribute. In this case, the attribute types are the same, but each value has a different language code.
For a list of the languages supported by Directory Server and their associated language tags, see Section D.2, “Supported Locales”.

Note

The language tag has no effect on how the string is stored within the directory. All object class and attribute strings are stored using UTF-8. The user is responsible for converting the data used in the LDIF to UTF-8. The iconv or uconv command provided by most operating systems can be used to convert data from the native characterset into UTF-8.
For example, Example Corporation has offices in the United States and France and wants employees to be able to view directory information in their native language. When adding directory entries, the directory administrator chooses to provide attribute values in both English and French. When adding a directory entry for a new employee, Babs Jensen, the administrator does the following:
  1. The administrator creates a file, street.txt, with the French street address value:
    1 rue de l'Université
  2. The file contents are then converted to UTF-8:
    iconv -t UTF-8 -o output.txt street.txt
  3. The following LDIF entry is created using the UTF-8 value of the street address value for streetAddress;lang-fr.
    dn: uid=bjensen,ou=people,dc=example,dc=com
    objectclass: top
    objectclass: person
    objectclass: organizationalPerson
    name: Babs Jensen
    cn: Babs Jensen
    sn: Jensen
    uid: bjensen
    streetAddress: 1 University Street
    streetAddress;lang-en: 1 University Street
    streetAddress;lang-fr:: AasljdoaAJASI023909jaASJaonasd0ADS
    preferredLanguage: fr
    The double colons after the attribute name and subtype indicate that the value is binary base-64 encoded.
Users accessing this directory entry with an LDAP client with the preferred language set to English will see the address 1 University Street. Users accessing the directory with an LDAP client with the preferred language set to French will see the address 1 rue de l'Université.