EVOLUTION-MANAGER
Edit File: update_pkg_po.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Prepare Translations for a Package</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for update_pkg_po {tools}"><tr><td>update_pkg_po {tools}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Prepare Translations for a Package </h2> <h3>Description</h3> <p>Prepare the ‘<span class="file">po</span>’ directory of a package and compile and install the translations. </p> <h3>Usage</h3> <pre> update_pkg_po(pkgdir, pkg = NULL, version = NULL, copyright, bugs) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>pkgdir</code></td> <td> <p>The path to the package directory.</p> </td></tr> <tr valign="top"><td><code>pkg</code></td> <td> <p>The package name: if <code>NULL</code> it is read from the package's ‘<span class="file">DESCRIPTION</span>’ file.</p> </td></tr> <tr valign="top"><td><code>version</code></td> <td> <p>The package version: if <code>NULL</code> it is read from the package's ‘<span class="file">DESCRIPTION</span>’ file.</p> </td></tr> <tr valign="top"><td><code>copyright, bugs</code></td> <td> <p>optional character strings for the <span class="samp">Copyright</span> and <span class="samp">Report-Msgid-Bugs-To</span> details in the template files.</p> </td></tr> </table> <h3>Details</h3> <p>This performs a series of steps to prepare or update messages in the package. </p> <ul> <li><p> If the package sources do not already have a ‘<span class="file">po</span>’ directory, one is created. </p> </li> <li> <p><code><a href="xgettext.html">xgettext2pot</a></code> is called to create/update a file ‘<span class="file">po/R-<var>pkgname</var>.pot</span>’ containing the translatable messages in the package. </p> </li> <li><p> All existing files in directory <code>po</code> with names ‘<span class="file">R-<var>lang</var>.po</span>’ are updated from ‘<span class="file">R-<var>pkgname</var>.pot</span>’, <code><a href="checkPoFiles.html">checkPoFile</a></code> is called on the updated file, and if there are no problems the file is compiled and installed under ‘<span class="file">inst/po</span>’. </p> </li> <li><p> In a UTF-8 locale, a ‘translation’ ‘<span class="file">R-en@quot.po</span>’ is created with UTF-8 directional quotes, compiled and installed under ‘<span class="file">inst/po</span>’. </p> </li> <li><p> The remaining steps are done only if file ‘<span class="file">po/<var>pkgname</var>.pot</span>’ already exists. The ‘<span class="file">src/*.{c,cc,cpp,m,mm}</span>’ files in the package are examined to create a file ‘<span class="file">po/<var>pkgname</var>.pot</span>’ containing the translatable messages in the C/C++ files. If there is a <code>src/windows</code> directory, files within it are also examined. </p> </li> <li><p> All existing files in directory <code>po</code> with names ‘<span class="file"><var>lang</var>.po</span>’ are updated from ‘<span class="file"><var>pkgname</var>.pot</span>’, <code><a href="checkPoFiles.html">checkPoFile</a></code> is called on the updated file, and if there are no problems the file is compiled and installed under ‘<span class="file">inst/po</span>’. </p> </li> <li><p> In a UTF-8 locale, a ‘translation’ ‘<span class="file">en@quot.po</span>’ is created with UTF-8 directional quotes, compiled and installed under ‘<span class="file">inst/po</span>’. </p> </li></ul> <p>Note that C/C++ messages are not automatically prepared for translation as they need to be explicitly marked for translation in the source files. Once that has been done, create an empty file ‘<span class="file">po/<var>pkgname</var>.pot</span>’ in the package sources and run this function again. </p> <p><code>pkg = "base"</code> is special (and for use by <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> developers only): the C files are not in the package directory but in the main sources. </p> <h3>System requirements</h3> <p>This function requires the following tools from the GNU <code>gettext-tools</code>: <code>xgettext</code>, <code>msgmerge</code>, <code>msgfmt</code>, <code>msginit</code> and <code>msgconv</code>. These are part of most Linux distributions and easily compiled from the sources on Unix-alikes (including macOS). Pre-compiled versions for Windows are available in <a href="https://www.stats.ox.ac.uk/pub/Rtools/goodies/gettext-tools.zip">https://www.stats.ox.ac.uk/pub/Rtools/goodies/gettext-tools.zip</a>. </p> <p>It will probably not work correctly for <code>en@quot</code> translations except in a UTF-8 locale, so these are skipped elsewhere. </p> <h3>See Also</h3> <p><code><a href="xgettext.html">xgettext2pot</a></code>. </p> <hr /><div style="text-align: center;">[Package <em>tools</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>