This chapter describes how to localize printer drivers for different languages and defaults.
The PPD compiler provides localization of PPD files in different languages through message catalog files in the GNU gettext format. Each user text string and several key PPD attribute values such as LanguageVersion and LanguageEncoding are looked up in the corresponding message catalog and the translated text is substituted in the generated PPD files. One message catalog file can be used by multiple driver information files, and each file contains a single language translation.
The DDK provides a utility program to aid in the localization of drivers called ppdpo(1). In addition, the standard DDK installation includes basic localizations of all standard media sizes and options in English, French, German, Italian, and Spanish.
Localizations are created using a few options to the PPD compiler which are covered later in this chapter.
Each message catalog file can be edited with your favorite text editor and consists of one or more messages translated into a single language. Comment lines can be included using the # character, for example:
# This is a comment
Each message is specified using a pair of directives: msgid and msgstr. The msgid string specifies the original (probably English) version of a string which is looked up when localizing a PPD file. The msgstr string contains the translated message. For example, the following message catalog translates the word "Yes" to French:
msgid "Yes" msgstr "Oui"
Each message catalog will also contain two special entries for the LanguageVersion and LanguageEncoding attribute values. The standard msgid values are "English" and "ISOLatin1", respectively. They should be replaced with the Adobe-defined keywords for the language being localized and the character encoding, respectively. Table 5-1 lists the standard LanguageVersion, LanguageEncoding, and corresponding POSIX language abbreviation values that are supported.
LanguageVersion | LanguageEncoding | POSIX |
---|---|---|
English | ISOLatin1 | en |
Chinese | None | zh |
Danish | ISOLatin1 | da |
Dutch | ISOLatin1 | nl |
Finnish | ISOLatin1 | fi |
French | ISOLatin1 | fr |
German | ISOLatin1 | de |
Italian | ISOLatin1 | it |
Japanese | JIS83-RKSJ | ja |
Norwegian | ISOLatin1 | no |
Portuguese | ISOLatin1 | pt |
Russian | None | ru |
Spanish | ISOLatin1 | es |
Swedish | ISOLatin1 | sv |
Turkish | None | tr |
The ppdpo program creates or updates a message catalog file based upon one or more driver information files. New messages are added with the word "TRANSLATE" added to the front of the translation string to make locating new strings for translation easier. The program accepts the message catalog filename and one or more driver information files.
For example, run the following command to create a new German message catalog called de.po for all of the driver information files in the current directory:
ppdpo -o de.po *.drv
If the file de.po already exists, ppdpo will update the contents of the file with any new messages that need to be translated.
Once you have created a message catalog, use the -c, -l, and -d options with ppdc to create PPD files in alternate languages. The -c option specifies the message catalog to use, the -l option specifies the POSIX language abbreviation, and the -d option specifies the output directory. For example, use the following command to generate the German PPD files for the drivers listed in mydrivers.drv into the directory ppd/de:
ppdc -c de.po -l de -d ppd/de mydrivers.drv