mirror of
https://github.com/php/doc-ja.git
synced 2026-03-23 22:52:11 +01:00
124 lines
3.1 KiB
XML
124 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 9dea6e3d7beb592477043126c57e3f6fc3cc5654 Maintainer: hirokawa Status: ready -->
|
|
<refentry xml:id="function.gettext" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>gettext</refname>
|
|
<refpurpose>現在のドメインのメッセージを参照する</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>gettext</methodname>
|
|
<methodparam><type>string</type><parameter>message</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
現在のドメインのメッセージを参照します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>message</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
翻訳するメッセージ。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
翻訳テーブルに翻訳文字列が見つかった場合にその文字列、
|
|
あるいは見つからなかった場合に元の文字列を返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>gettext</function> のチェック</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// ドイツ語に設定します
|
|
putenv('LC_ALL=de_DE');
|
|
setlocale(LC_ALL, 'de_DE');
|
|
|
|
// 変換テーブルの場所を指定します
|
|
bindtextdomain("myPHPApp", "./locale");
|
|
|
|
// ドメインを選択します
|
|
textdomain("myPHPApp");
|
|
|
|
// 翻訳内容は ./locale/de_DE/LC_MESSAGES/myPHPApp.mo から検索されます
|
|
|
|
// テストメッセージを出力します
|
|
echo gettext("Welcome to My PHP Application");
|
|
|
|
// あるいは、gettext() のかわりに _() も使用可能です
|
|
echo _("Have a nice day");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
この関数のエイリアスとして、アンダースコア文字 '_'
|
|
を使用することができます。
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
言語を設定するだけではだめなシステムもあり、
|
|
<function>putenv</function> を使って正しいロケールを定義しなければなりません。
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>_</function></member>
|
|
<member><function>setlocale</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|