「多言語シンタックス」の版間の差分

提供:MoodleDocs
移動先:案内検索
編集の要約なし
(多言語コンテンツフィルタへの転送ページ)
 
(2人の利用者による、間の41版が非表示)
1行目: 1行目:
作成中です - [[利用者:Mitsuhiro Yoshida|Mitsuhiro Yoshida]] 2007年7月5日 (木) 14:34 (CDT)
#REDIRECT[[多言語コンテンツフィルタ]]
 
ロケーション: 管理 > モジュール > フィルタ
 
多言語コンテンツフィルタでは、多言語のリソースを作成することができます。有効にした場合、 テキストが多言語を含んでいることを意味する <nowiki><span lang="xx" class="multilang"></nowiki> タグが表示されます。Then it selects and outputs the best language for the current user. The language of the resource will change when the user changes their selected Moodle language.
 
The multilang syntax was changed in 1.8. <nowiki><lang></nowiki> is not supported any more. It is required to add ''class="multilang"'' into each <nowiki><span></nowiki> tag in multilang block. The new syntax is backwards compatible with old plugins, which means it can be used in older Moodle version.
 
== How to use in a course ==
 
To use this feature first create your contents in multiple languages (in the same resource). Then enclose each language block (aka multilang block) in the following tags:
 
      <nowiki><span lang="XX" class="multilang">your_content_here</span>
      <span lang="YY" class="multilang">your_content_in_other_language_here</span></nowiki>
 
It is essential to be in '''the code editing mode''' (press <nowiki>[<>]</nowiki> in the HTML editor), when you enter these tags for them to work. Only spaces, tabs and enters can be used between the individual languages in the multilang block. Please note that ''class="multilang"'' is not required prior to 1.8.
 
Following code
      <nowiki><lang="XX">your_content_here</lang>
      <lang="YY">your_content_in_other_language_here</lang></nowiki>
does NOT work.
 
The obsoleted HTML tagging
      <nowiki><lang lang="XX">your_content_here</lang>
      <lang lang="YY">your_content_in_other_language_here</lang>
 
      <span lang="XX">your_content_here</span>
      <span lang="YY">your_content_in_other_language_here</span></nowiki>
will not work in 1.8 and later. In 1.8 the lang attribute without ''class="multilang"'' can be used to mark the language of the text - see http://www.w3.org/TR/html4/struct/dirlang.html
 
== How it works internally ==
 
# Filter first looks for ''multilang blocks'' in the text
# For each multilang block:
#* If there are texts in the currently active language, print them
#* Else, if there exists texts in the current parent language, print them
#* Else, print the first language found in the text
# Text outside of multilang blocks will be shown always
 
==Course summary and title tags==
 
To be able to change text such as resource titles and summaries, an administrator must choose ''Filter all strings'' in the site administration.
 
<nowiki> <span lang="en" class="multilang">Matematically</span> <span lang="sv" class="multilang">Matematiskt (svenska)</span></nowiki>
functions as English or Swedish title.
 
It doesn't seem to work for course titles (neither long nor short version).
 
In the course summary:
 
<nowiki><span lang="en" class="multilang">Growth is often a major concern in planning society.
How can one avoid superficial conclusions? <br>
(Exists in Swedish too. Finns på svenska också)</span>
<span lang="sv" class="multilang">Tillväxt är ofta använt i samhällsdebatten.
Hur kan man undvika ytliga slutsatser?
(Finns på engelska också. Exists in English too.)
<br /></span> </nowiki>
 
Can show in the chosen language (and point out that the other language is there). Please note that ''class="multilang"'' is not required prior to Moodle 1.8.
 
== Translations with tags ==
If you wish to translate a word or phrase in an English text to another language:
 
<nowiki>If I want to include an explanation <span lang="en"> </span>
<span lang="sv" class="multilang">(sv: förklaring)</span> in a running text can I do it?
<br />
<br /><span lang="en" class="multilang>If I want to include an explanation in a running text
can I do it? </span>
<span lang="sv" class="multilang>If I want to include an explanation (sv: förklaring) in a
running text can I do it?</span></nowiki>
 
would both work, but not:
 
<nowiki>If I want to include an explanation <span lang="en" class="multilang></span>
<span lang="sv" class="multilang>(sv: förklaring)</span> in a running text can I do it?
<br />If I want to include an explanation <span lang="sv" class="multilang>(sv: förklaring)</span>
in a running text can I do it?<br /></nowiki>
which would show the Swedish even if English was the chosen language. NOTE that before 1.8 the "span lang=en" must contain something, at least a space.
 
== New multilang syntax ==
{{Moodle 1.8}}
* <nowiki><span lang="xx"> and <lang></nowiki> should not be used anymore
* Existing content can be upgraded using the admin/multilangupgrade.php script, there is a link in the admin notification page if a multilang upgrade is required.
* The multilang filter can be configured to use old syntax only - see ''Multi-Language Content Settings''; this setting may be removed in 1.9
* New syntax is forced during a new 1.8 installation, for upgraded sites the new syntax is enabled after the multilang upgrade
 
== Common problems ==
 
* The multilang filter is not enabled - go to filter settings and enable it
* ''Filter all strings'' not enabled on sites that need multilang in titles, navigation, headings, etc.
* Extra characters between language span tags - editor might add <nowiki><br /></nowiki> or other tags, please review the html in source view
* Extra spaces in language span tag
 
== 関連情報 ==
 
*[[Filters (administrator)]]
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=51603 Multilanguage filter - does not work ...] forum discussion
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=74340 Problems with multilang filter and SPAN tags] forum discussion
 
[[Category:教師]]
[[Category:フィルタ]]
 
[[en: Multi_language_content]]

2021年3月5日 (金) 05:28時点における最新版