mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-09 00:31:45 +01:00
added Japanese translation files.
This commit is contained in:
91
docs/ja/programmers/api-functions/api-register-block.xml
Normal file
91
docs/ja/programmers/api-functions/api-register-block.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.6 Maintainer: takagi Status: ready -->
|
||||
<!-- CREDITS: mat-sh,daichi,joe -->
|
||||
<refentry id="api.register.block">
|
||||
<refnamediv>
|
||||
<refname>register_block()</refname>
|
||||
<refpurpose>ブロック関数プラグインを動的に登録します。</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>説明</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_block</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
|
||||
<methodparam><type>bool</type><parameter>cacheable</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
<link linkend="plugins.block.functions">ブロック関数プラグイン</link>
|
||||
を動的に登録します。パラメータには、ブロック関数名とそれを実装する
|
||||
PHP のユーザー定義関数名を渡します。
|
||||
</para>
|
||||
&api.register.snippet;
|
||||
|
||||
<para>
|
||||
<parameter>cacheable</parameter> と <parameter>cache_attrs</parameter>
|
||||
はほとんどの場合に省略可能です。これらの正しい使用法についての詳細は、
|
||||
<link linkend="caching.cacheable">キャッシュ可能なプラグインの出力の制御</link>
|
||||
を参照して下さい。
|
||||
</para>
|
||||
<example>
|
||||
<title>register_block()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// 関数の宣言
|
||||
function do_translation ($params, $content, &$smarty, &$repeat)
|
||||
{
|
||||
if (isset($content)) {
|
||||
$lang = $params['lang'];
|
||||
// $content においていくつかの変換を行います
|
||||
return $translation;
|
||||
}
|
||||
}
|
||||
|
||||
// smarty に登録します
|
||||
$smarty->register_block('translate', 'do_translation');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
テンプレート
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{translate lang='br'}Hello, world!{/translate}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
<link linkend="api.unregister.block"><varname>unregister_block()</varname></link>
|
||||
および
|
||||
<link linkend="plugins.block.functions">ブロック関数プラグイン</link>
|
||||
のページも参照してください。
|
||||
</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
|
||||
-->
|
||||
Reference in New Issue
Block a user