php-doc-en/reference/gettext/functions/gettext.xml
Jakub Vrana 55be0d09b6 Path to a file with the translation
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@154845 c90b9560-bf6c-de11-be94-00142212c4b1
2004-03-29 14:27:13 +00:00

71 lines
1.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/gettext.xml, last change in rev 1.2 -->
<refentry id="function.gettext">
<refnamediv>
<refname>gettext</refname>
<refpurpose>Lookup a message in the current domain</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>gettext</methodname>
<methodparam><type>string</type><parameter>message</parameter></methodparam>
</methodsynopsis>
<para>
This function returns a translated string if one is found in the
translation table, or the submitted message if not found. You may
use the underscore character '_' as an alias to this function.
</para>
<example>
<title><function>gettext</function>-check</title>
<programlisting role="php">
<![CDATA[
<?php
// Set language to German
setlocale(LC_ALL, 'de_DE');
// Specify location of translation tables
bindtextdomain("myPHPApp", "./locale");
// Choose domain
textdomain("myPHPApp");
// Translation is looking for in ./locale/de_DE/LC_MESSAGES/myPHPApp.mo now
// Print a test message
echo gettext("Welcome to My PHP Application");
// Or use the alias _() for gettext()
echo _("Have a nice day");
?>
]]>
</programlisting>
</example>
<para>
See also
<function>setlocale</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->