Language tags

The term language tags defines a mechanism that enables the Directory Server to associate natural language codes with values held in a directory and enables clients to query the directory for values that meet certain natural language requirements.

The language tag is a component of an attribute description. The language tag is a string with the prefix lang-, a primary subtag of alphabetic characters and, optionally, subsequent subtags connected by a hyphen (-). The subsequent subtags can be any combination of alphanumeric characters; only the primary subtag needs to be alphabetic. The subtags can be any length; the only limitation is that the total length of the tag cannot exceed 240 characters. Language tags are not case sensitive; en-us and en-US and EN-US are identical. Language tags are not allowed in components of DN or RDN. Only one language tag per attribute description is allowed.

Note: On a per attribute basis, language tags are mutually exclusive with unique attributes. If you have designated a particular attribute as being a unique attribute, it cannot have language tags associated with it.

If language tags are included when data is added to a directory, they can be used with search operations to selectively retrieve attribute values in specific languages. If a language tag is provided in an attribute description within the requested attribute list of a search, then only attribute values in a directory entry that have the same language tag as that provided are to be returned. Thus for a search like:

ldapsearch -b "o=ibm,c=us" (objectclass=organization) description;lang-en

the server returns values of an attribute "description;lang-en", but does not return values of an attribute "description" or "description;lang-fr".

If a request is made specifying an attribute without providing a language tag, then all attribute values regardless of their language tag are returned.

The attribute type and the language tag are separated with a semicolon (;) character.

Note: The semicolon character is allowed to be used in the "NAME" part of an AttributeType. However, because this character is being used to separate the AttributeType from the language tag, its usage in the "NAME" part of an AttributeType is not permitted.

For example, if the client requests a "description" attribute and a matching entry contains:

objectclass: top
objectclass: organization
o: Software GmbH
description: software
description;lang-en: software products
description;lang-de: Softwareprodukte
postalAddress: Berlin 8001 Germany
postalAddress;lang-de: Berlin 8001 Deutschland

the server returns:

description: software
description;lang-en: software products
description;lang-de: Softwareprodukte

If the search requests a "description;lang-de" attribute, then the server returns:

description;lang-de: Softwareprodukte

The use of language tags allows for multi-lingual data in directories that can support clients that operate in various languages. Using language tags, an application can be written so that a German client sees only the data entered for the lang-de attribute, and the French client sees only the data entered for the lang-fr attribute.

To determine whether the language tag function is enabled, issue a root DSE search specifying the attribute "ibm-enabledCapabilities".

ldapsearch -b "" -s base objectclass=* ibm-enabledCapabilities

If the OID "1.3.6.1.4.1.4203.1.5.4" is returned, the function is enabled.

If the language tag support is not enabled, any LDAP operation that associates a language tag with an attribute is rejected with an error message.

Some attributes can have language tags associated with them, while some cannot. To determine whether or not an attribute allows language tags, use the ldapexop command:

  • For attributes that allow language tags: ldapexop -op getattributes -attrType language_tag -matches true
  • For attributes that don't allow language tags: ldapexop -op getattributes -attrType language_tag -matches false