Attention : vous consultez actuellement la documentation dédiée aux versions 1.x de Moodle. La documentation pour les versions 2.x de Moodle est consultable ici : Contenus multilingues, celle pour les versions 3.x de Moodle est consultable ici : Contenus multilingues et celle pour Moodle 4.x est consultable là : Contenus multilingues.

« Contenus multilingues » : différence entre les versions

De MoodleDocs
Aller à :navigation, rechercher
Aucun résumé des modifications
 
Ligne 4 : Ligne 4 :


== Présentation du multi langage ==
== Présentation du multi langage ==
Voir aussi : [[Filtres_%28administrateur%29#Contenus_multilingues]]


The Multi-language content filter enables resources to be created in multiple languages. When turned on, it looks for <nowiki><span lang="xx" class="multilang"></nowiki> tags which indicate that a text contains multiple languages. 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 Multi-language content filter enables resources to be created in multiple languages. When turned on, it looks for <nowiki><span lang="xx" class="multilang"></nowiki> tags which indicate that a text contains multiple languages. 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.

Version du 14 décembre 2006 à 13:48

Remarque : la traduction de cet article n'est pas terminée. N'hésitez pas à traduire tout ou partie de cette page ou à la compléter. Vous pouvez aussi utiliser la page de discussion pour vos recommandations et suggestions d'améliorations.


Moodle will allow different resources to appear to users based upon their language. There is a filter called Multi language content (voir Filtres (administrateur)) and it should be turned on. This page goes into details of several ways of displaying resources to users based on language.

Présentation du multi langage

Voir aussi : Filtres_(administrateur)#Contenus_multilingues

The Multi-language content filter enables resources to be created in multiple languages. When turned on, it looks for <span lang="xx" class="multilang"> tags which indicate that a text contains multiple languages. 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. <lang> is not supported any more. It is required to add class="multilang" into each <span> tag in multilang block. The new syntax is backwards compatible with old plugins, which means it can be used in older Moodle version.

Comment l'utiliser

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:

      <span lang="XX" class="multilang">your_content_here</span>
      <span lang="YY" class="multilang">your_content_in_other_language_here</span>

It is essential to be in the code editing mode (press [<>] 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 mulitang block. Please note that class="multilang" is not required prior to 1.8.

Following code

      <lang="XX">your_content_here</lang>
      <lang="YY">your_content_in_other_language_here</lang>

does NOT work.

The obsoleted HTML tagging

      <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>

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

Comment cela fonctionne en interne

  1. filter first looks for multilang blocks in the text
  2. for each multilang block:
    1. if there are texts in the currently active language, print them
    2. else, if there exists texts in the current parent language, print them
    3. else, print the first language found in the text
  3. text outside of multilang blocks will be showed always

Résumé de cours et balise de titre

To be able to change even resource titles and summaries, you must chose Filter all strings in the adminstration choices.

 <span lang="en" class="multilang">Matematically</span> <span lang="sv" class="multilang">Matematiskt (svenska)</span>

would function as English or Swedish title.

It doesn't seem to work for course titles (neither long nor short version).

In the course summary:

<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> 

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.

Traductions avec balises

If I were to want to translate a word or phrase to a chosen language in an English text:

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>

would both work, but not:

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 />

which would show the Swedish even if English was the chosen language. NOTE taht before 1.8 the "span lang=en" must contain something, at least a space.

Nouvelle syntaxe multilingue

Moodle1.8


  • <span lang="xx"> and <lang> should not be used anymore
  • existing content can be upgraded using admin/multilangupgrade.php script, there is a link on admin notification page if the upgrade is needed
  • 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 new installation in 1.8, for upgraded sites the new syntax is enabled after the Multilang upgrade

Problèmes communs

  • 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 <br /> or other tags, please review the html in source view
  • extra spaces in language span tag

Voir aussi

Filtres (administrateur)

Discussion http://moodle.org/mod/forum/discuss.php?d=51603 (en anglais)