Localized text
The Certified PDF 2 specification supports localization by
allowing several text properties to contain alternate text strings in multiple languages. The
scripting API offers two ways to handle the values of such localized properties.
- Work with a single value
- For each localized property the scripting API offers a getter and a setter working
with a single string value:
- The getter returns one of the available alternates, selected by preference in the
following order: the English language string, the default string, or any other
language string. The getter returns a non-empty string as long as there is at least
one alternate string.
- The setter sets the specified string as the English language string and erases all
other alternates (to avoid discrepancies between the meaning of existing alternates
and the new string).
This is the preferred mechanism for script programs running in an environment
where localization in languages other than English is not relevant.
- Work with all alternates
- For each localized property the scripting API also offers a getter that returns an
AltText object, representing the complete set of alternate strings. The AltText class
offers methods to access any language alternate, both for reading and writing. An
AltText object serves as a reference to its underlying localized property, so it can be
used to update the property. Consequently there are no setters accepting an AltText
object. This is the preferred mechanism for script programs running in an environment
that needs localization in languages other than English.