1
2
3
4
5
6
|
<h1 class="subsubsection">Locale-Specific Translation</h1> <p>Prefixing a double-quoted string with a dollar sign (‘<samp>$</samp>’), such as <code>$"hello, world"</code>, will cause the string to be translated according to the current locale. The <code>gettext</code> infrastructure performs the lookup and translation, using the <code>LC_MESSAGES</code>, <code>TEXTDOMAINDIR</code>, and <code>TEXTDOMAIN</code> shell variables, as explained below. See the gettext documentation for additional details not covered here. If the current locale is <code>C</code> or <code>POSIX</code>, if there are no translations available, of if the string is not translated, the dollar sign is ignored. Since this is a form of double quoting, the string remains double-quoted by default, whether or not it is translated and replaced. If the <code>noexpand_translation</code> option is enabled using the <code>shopt</code> builtin (see <a href="the-shopt-builtin">The Shopt Builtin</a>), translated strings are single-quoted instead of double-quoted. </p> <p>The rest of this section is a brief overview of how you use gettext to create translations for strings in a shell script named <var>scriptname</var>. There are more details in the gettext documentation. </p><div class="_attribution">
<p class="_attribution-p">
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br>
<a href="https://www.gnu.org/software/bash/manual/html_node/Locale-Translation.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Locale-Translation.html</a>
</p>
</div>
|