当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムWordSlack #docs チャンネルでお知らせください。</p>

「関数リファレンス/load child theme textdomain」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
([:en:Function_Reference/load_child_theme_textdomain] 2013-05-17T01:15:46‎ KingYes 版)
 
2行目: 2行目:
  
  
== Description ==
+
<div id="Description ">
Loads the child theme's translated strings.
+
== 説明 ==
 +
</div>
 +
子テーマの翻訳文字列を読み込みます。
  
If the current locale exists as a .mo file in the child theme's root directory, it will be included in the translated strings by the <tt>$domain</tt>.
+
現在のロケールが .mo ファイルとして子テーマのルートディレクトリに存在している場合、 <tt>$domain</tt> の翻訳文字列として読み込まれます。
  
The .mo files must be <strong>named based on the locale exactly</strong>, <code>de_DE.mo</code> for example.
+
.mo ファイルは <code>ja.mo</code> <code>de_DE.mo</code> のように <strong>ロケールの正確な名前</strong> にする必要があります。
  
This function is the proper way to load translations for a child theme. For the parent theme/single themes <tt>load_theme_textdomain()</tt> is used instead. Loading child theme translations extra is better to optimize the loading process and helps organize code and files better.
+
この関数は子テーマの翻訳をロードする適切な方法です。親テーマやシングルテーマには代わりに <tt>load_theme_textdomain()</tt> を使用します。 Loading child theme translations extra is better to optimize the loading process and helps organize code and files better.
  
Example: If you are using "Twenty Eleven" as your parent theme it already comes with the function <tt>load_theme_textdomain()</tt> in place and there are already translations for this theme available in numerous languages. Now you have created a child theme for it with lots of custom elements like new sidebars or other sections. All strings of these new sections in frontend and also backend should be controlled by the child theme's translations files. If the parent theme gets updated (and most likely its language strings too...) your child theme translations keep untouched. So that's the proper way of doing it and WordPress is prepared for that out of the box.
+
: If you are using "Twenty Eleven" as your parent theme it already comes with the function <tt>load_theme_textdomain()</tt> in place and there are already translations for this theme available in numerous languages. Now you have created a child theme for it with lots of custom elements like new sidebars or other sections. All strings of these new sections in frontend and also backend should be controlled by the child theme's translations files. If the parent theme gets updated (and most likely its language strings too...) your child theme translations keep untouched. So that's the proper way of doing it and WordPress is prepared for that out of the box.
  
== Usage ==
+
<div id="Usage">
 +
== 使い方 ==
 +
</div>
 
  <?php load_child_theme_textdomain( $domain, $path ) ?>
 
  <?php load_child_theme_textdomain( $domain, $path ) ?>
  
== Parameters ==
+
<div id="Parameters">
 +
== パラメータ ==
 +
</div>
 
{{Parameter|$domain|string|Unique identifier for retrieving translated strings.}}
 
{{Parameter|$domain|string|Unique identifier for retrieving translated strings.}}
 
{{Parameter|$path|unknown|The directory where the .mo file can be found (without the trailing slash).|optional|false}}
 
{{Parameter|$path|unknown|The directory where the .mo file can be found (without the trailing slash).|optional|false}}
  
== Return Values ==
+
<div id="Return Values">
; (bool) : This function return TRUE as textdomain well loaded, FALSE on failure.
+
== 返り値 ==
 +
</div>
 +
; (bool) : テキストドメインが読み込まれた際に TRUE を、失敗した際に FALSE を返します.
  
== Example ==
+
== ==
The load_child_theme_textdomain() function should generally be called from within the [[Plugin_API/Action_Reference/after_setup_theme|after_setup_theme]] action hook, just the same as with its related load_theme_textdomain() function.
+
The load_child_theme_textdomain() function should generally be called from within the [[プラグイン_API/アクションフック一覧/after_setup_theme|after_setup_theme]] action hook, just the same as with its related load_theme_textdomain() function.
 
<pre>
 
<pre>
 
add_action( 'after_setup_theme', 'my_child_theme_setup' );
 
add_action( 'after_setup_theme', 'my_child_theme_setup' );

2015年6月7日 (日) 15:43時点における版

このページはラフドラフトで、まだ内容の検証が済んでいません。情報が間違っていたり書き直されることがあります。
執筆中のため、執筆者の許可なく編集しないでください

このページ「関数リファレンス/load child theme textdomain」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています


子テーマの翻訳文字列を読み込みます。

現在のロケールが .mo ファイルとして子テーマのルートディレクトリに存在している場合、 $domain の翻訳文字列として読み込まれます。

.mo ファイルは ja.mode_DE.mo のように ロケールの正確な名前 にする必要があります。

この関数は子テーマの翻訳をロードする適切な方法です。親テーマやシングルテーマには代わりに load_theme_textdomain() を使用します。 Loading child theme translations extra is better to optimize the loading process and helps organize code and files better.

例: If you are using "Twenty Eleven" as your parent theme it already comes with the function load_theme_textdomain() in place and there are already translations for this theme available in numerous languages. Now you have created a child theme for it with lots of custom elements like new sidebars or other sections. All strings of these new sections in frontend and also backend should be controlled by the child theme's translations files. If the parent theme gets updated (and most likely its language strings too...) your child theme translations keep untouched. So that's the proper way of doing it and WordPress is prepared for that out of the box.

使い方

<?php load_child_theme_textdomain( $domain, $path ) ?>

パラメータ

$domain
string) (必須) Unique identifier for retrieving translated strings.
初期値: なし
$path
unknown) (optional) The directory where the .mo file can be found (without the trailing slash).
初期値: false

返り値

(bool) 
テキストドメインが読み込まれた際に TRUE を、失敗した際に FALSE を返します.

The load_child_theme_textdomain() function should generally be called from within the after_setup_theme action hook, just the same as with its related load_theme_textdomain() function.

add_action( 'after_setup_theme', 'my_child_theme_setup' );
function my_child_theme_setup() {
    load_child_theme_textdomain( 'my_child_theme', get_stylesheet_directory() . '/languages' );
}

The .mo files must use language-only filenames, like languages/de_DE.mo in your child theme directory.

Unlike plugin language files, a name like my_child_theme-de_DE.mo will NOT work. Although plugin language files allow you to specify the text-domain in the filename, this will NOT work with themes and child themes. Language files for themes should include the language shortcut ONLY.

Notes

Internationalization and localization (other correct spellings are internationalisation and localisation) are means of adapting computer software to different languages.

  • l10n is an abbreviation for localization.
  • i18n 18 stands for the number of letters between the first i and last n in internationalization.

Change Log

Since: 2.9.0

Source File

load_child_theme_textdomain()wp-includes/l10n.php にあります。

Related

ローカライズ: get_locale() /en, load_default_textdomain() /en, load_plugin_textdomain() /en, load_textdomain() /en, load_theme_textdomain()

最新英語版: WordPress Codex » Function_Reference/load_child_theme_textdomain最新版との差分


関数リファレンステンプレートタグ目次もご覧ください。