1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
<html>
<body>
<div align='justify'>
<h1 align='right'><a name='LOCALIZATION'>5 - Localizing Printer Drivers</a></h1>
<p>This chapter describes how to localize printer drivers for
different languages and defaults.</p>
<h2>Overview of the Localization Process</H2>
<p>The PPD compiler provides localization of PPD files in
different languages through <i>message catalog</i> files in the
GNU gettext format. Each user text string and several key PPD
attribute values such as <tt>LanguageVersion</tt> and
<tt>LanguageEncoding</tt> 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.</p>
<p>The DDK provides a utility program to aid in the
localization of drivers called <tt>ppdpo(1)</tt>. In addition,
the standard DDK installation includes basic localizations of
all standard media sizes and options in English, French, German,
Italian, Spanish, and Japanese.</p>
<p>Localizations are created using a few options to the PPD
compiler which are covered later in this chapter.</p>
<h2>The Message Catalog File Format</h2>
<p>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
<tt>#</tt> character, for example:</p>
<pre>
# This is a comment
</pre>
<p>Each message is specified using a pair of directives:
<tt>msgid</tt> and <tt>msgstr</tt>. The <tt>msgid</tt> string
specifies the original (probably English) version of a string
which is looked up when localizing a PPD file. The
<tt>msgstr</tt> string contains the translated message. For
example, the following message catalog translates the word
"Yes" to French:</p>
<pre>
msgid "Yes"
msgstr "Oui"
</pre>
<p>Each message catalog will also contain two special entries
for the <tt>LanguageVersion</tt> and <tt>LanguageEncoding</tt>
attribute values. The standard <tt>msgid</tt> 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. <a
href='#TABLE5-1'>Table 5-1</a> lists the standard
<tt>LanguageVersion</tt>, <tt>LanguageEncoding</tt>, and
corresponding POSIX language abbreviation values that are
supported.</p>
<h2>The ppdpo Localization Utility</h2>
<p>The <tt>ppdpo</tt> 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.</p>
<p>For example, run the following command to create a new German
message catalog called <var>de.po</var> for all of the driver
information files in the current directory:</p>
<pre>
<kbd>ppdpo -o de.po *.drv</kbd>
</pre>
<p>If the file <var>de.po</var> already exists, <tt>ppdpo</tt>
will update the contents of the file with any new messages that
need to be translated.</p>
<!-- NEW PAGE -->
<center><table width='80%' border='1' cellpadding='5' cellspacing='0'>
<caption align='bottom'><a name='TABLE5-1'><i>Table 5-1,
Supported LanguageVersion, LanguageEncoding, and POSIX language
abbreviation values.</i></a></caption>
<tr bgcolor='#cccccc'>
<th>LanguageVersion</th>
<th>LanguageEncoding</th>
<th>POSIX</th>
</tr>
<tr>
<td align='center'><tt>English</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>en</tt></td>
</tr>
<tr>
<td align='center'><tt>Chinese</tt></td>
<td align='center'><tt>None</tt></td>
<td align='center'><tt>zh</tt></td>
</tr>
<tr>
<td align='center'><tt>Danish</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>da</tt></td>
</tr>
<tr>
<td align='center'><tt>Dutch</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>nl</tt></td>
</tr>
<tr>
<td align='center'><tt>Finnish</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>fi</tt></td>
</tr>
<tr>
<td align='center'><tt>French</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>fr</tt></td>
</tr>
<tr>
<td align='center'><tt>German</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>de</tt></td>
</tr>
<tr>
<td align='center'><tt>Italian</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>it</tt></td>
</tr>
<tr>
<td align='center'><tt>Japanese</tt></td>
<td align='center'><tt>JIS83-RKSJ</tt></td>
<td align='center'><tt>ja</tt></td>
</tr>
<tr>
<td align='center'><tt>Norwegian</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>no</tt></td>
</tr>
<tr>
<td align='center'><tt>Portuguese</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>pt</tt></td>
</tr>
<tr>
<td align='center'><tt>Russian</tt></td>
<td align='center'><tt>None</tt></td>
<td align='center'><tt>ru</tt></td>
</tr>
<tr>
<td align='center'><tt>Spanish</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>es</tt></td>
</tr>
<tr>
<td align='center'><tt>Swedish</tt></td>
<td align='center'><tt>ISOLatin1</tt></td>
<td align='center'><tt>sv</tt></td>
</tr>
<tr>
<td align='center'><tt>Turkish</tt></td>
<td align='center'><tt>None</tt></td>
<td align='center'><tt>tr</tt></td>
</tr>
<tr>
<td colspan='3' bgcolor='#cccccc'><b>Note:</b>
<p>The <tt>LanguageVersion</tt> and <tt>LanguageEncoding</tt>
strings are only used when creating single-language PPD files.</p>
<p>Globalized PPD files, which contain multiple languages in a single PPD file, always report "English" and "ISOLatin1" for the primary localization and provide the other languages using the UTF-8 encoding.</p>
</td>
</tr>
</table></center>
<!-- NEW PAGE -->
<h2>Using a Message Catalog with the PPD Compiler</h2>
<p>Once you have created a message catalog, use the <tt>-c</tt>, <tt>-l</tt>, and <tt>-d</tt> options with <tt>ppdc</tt> to create PPD files in alternate languages. The <tt>-c</tt> option specifies the message catalog to use, the <tt>-l</tt> option specifies the standard DDK-supplied message catalog using the POSIX language abbreviation, and the <tt>-d</tt> option specifies the output directory. For example, use the following command to generate the German PPD files for the drivers listed in <var>mydrivers.drv</var> into the directory <var>ppd/de</var>:</p>
<pre>
<kbd>ppdc -l de -c de.po -d ppd/de mydrivers.drv</kbd>
</pre>
<h2>Using Multiple Message Catalogs</h2>
<p>When you want to generate globalized PPD files containing multiple languages, start by listing any message catalog files in your driver information file using the <tt>#po</tt> directive:</p>
<pre>
#po de "de.po" // German
#po es "es.po" // Spanish
#po fr "fr.po" // French
#po it "it.po" // Italian
#po ja "ja.po" // Japanese
</pre>
<p>Then run the <tt>ppdc</tt> command, listing each language you want to include after the <tt>-l</tt> option. Each language name must be separated by a comma. For example, use the following command to generate globalized PPD files in English, German, Spanish, French, Italian, and Japanese for the drivers listed in <var>mydrivers.drv</var> into the directory <var>ppd</var>:</p>
<pre>
<kbd>ppdc -l en,de,es,fr,it,ja -d ppd mydrivers.drv</kbd>
</pre>
<h2>Merging Existing Single-Language PPD Files</h2>
<p>The <tt>ppdmerge(1)</tt> utility allows you to merge existing single-language PPD files into a single globalized (multiple-language) PPD file. Simply provide the name of the PPD file you want to create or update with the <tt>-o</tt> option followed by a list of PPD files to merge. If the output file already exists, <tt>ppdmerge</tt> will load that PPD file first and then add the translations from the other PPD files to it.</p>
<p>For example, run the following command to merge all of the FooJet 2000 PPD files (each in their own language subdirectory and called <var>foojet2k.ppd</var>) into a single globalized PPD file called <var>foojet2k.ppd</var>:</p>
<pre>
<kbd>ppdmerge -o foojet2k.ppd */foojet2k.ppd</kbd>
</pre>
<!-- NEED 6 -->
<p>Similarly, run the following commands to incrementally add the French and Italian translations to the English PPD file:</p>
<pre>
<kbd>ppdmerge -o foojet2k.ppd fr/foojet2k.ppd</kbd>
<kbd>ppdmerge -o foojet2k.ppd it/foojet2k.ppd</kbd>
</pre>
</div>
</body>
</html>
|