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

« Personnalisation de la langue » : différence entre les versions

De MoodleDocs
Aller à :navigation, rechercher
(Page créée avec « {{Traduction}}{{Langue}} Words or phrases (in any language) used on the site may be easily changed by an administrator using the language customization feature. For example, ... »)
 
m (Liens automatiques invalides désactivés)
 
(7 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
{{Traduction}}{{Langue}}
{{Langue}}
Words or phrases (in any language) used on the site may be easily changed by an administrator using the language customization feature. For example, you may want to change the word "Course" to "Unit". The process consists of 4 steps:
Les mots ou phrases utilisées sur Moodle peuvent être facilement modifiées par un administrateur à l'aide de la fonctionnalité de ''Personnalisation de la langue''. Par exemple, on peut changer le mot « Cours » par « Période ». Le processus comprend 4 étapes :


# Check-out the strings
# charger les chaînes de caractères à modifier dans l'interface de modification,
# Filter the strings you wish to customize
# filtrer les chaînes pour afficher les chaînes à modifier,
# Customize the strings
# modifier les chaînes,
# Save and check-in the strings
# enregistrer, pour implanter les chaînes dans votre site.


== Quick instructions for the impatient ==
== Instructions rapides pour les impatients ==


# Go to the ''Administration > Site administration > Language> Language customization'' page.
# Ouvrir la page ''Administration > Administration du site > Langue > Personnalisation de la langue''.
# Pick the language to customize from the pull down list.
# Sélectionner la langue à modifier dans le menu déroulant.
# Click the "Open languge pack for editing" button. This may take time to process.
# Cliquer sur le bouton « Ouvrir le paquetage de langue pour modification » et patienter, car cela peut prendre un peu de temps. Cliquer sur « Continuer ».
# Click or Ctrl+Click to select files on the "Filter strings" interface. Notice files are grouped. For example, you will find the lesson strings under "mod" and moodle.php under core.
# Sélectionner un ou des fichiers dans l'interface de filtrage des chaînes. Les fichiers sont groupés. On trouve par exemple les fichiers de l'activité Leçon dans « mod » et le fichier moodle.php sous « core ».
# After selecting the file(s), it is possible to use "string must contain" and other filters. For example, look at only string text that has "teacher" the file(s) you selected.
# Une fois un ou des fichiers sélectionnés, il est possible d'affiner la sélection des chaînes à l'aide d'autres filtres, par exemple « Chaînes contenant ». Cliquer sur « Afficher les chaînes ».
# Click "Save changes and continue editing" if you want to pick another filter or PHP file(s) to edit.
# Saisir dans l'interface le texte destiné à remplacer le terme standard. Pour référence, l'original en anglais est également affiché.
# Click "Save and check in string into files" to save all changes you have made.   
# Cliquer sur « Enregistrer et continuer les modifications » si vous voulez modifier des chaînes d'autres fichiers.
# Cliquer sur « Enregistrer les modifications dans le paquetage de langue » pour enregistrer toutes les modifications effectuées.   


:''Tip:'' Do not see any string changes? Did you remember to use the "Save and check in string into files" button? Did you refresh your browser so it is not looking at a cached page? Did you edit the language file that is actually being used in your site, course or by the user?
:'''Astuce''' : vous ne voyez pas vos chaînes modifiées ? Avez-vous bien cliqué pour terminer sur le bouton « Enregistrer les chaînes dans le paquetage de langue »? Avez-vous actualisé l'affichage de votre navigateur ? Avez-vous bien modifié la chaîne utilisée dans ce cours ?


:''Tip:'' Can't find the string you wish to change? Tick the 'Show origin of languages strings' checkbox in ''Administration > Site administration > Development > Debugging'' then visit the page containing the string you want to customize.
:'''Astuce''' : impossible de trouver la chaîne que vous voulez modifier ? Cochez la case « Afficher l'origine des chaînes de caractères » dans ''Administration > Administration du site > Développement > Débogage'', puis visitez la page contenant la chaîne que vous voulez modifier en ajoutant « &strings=1 » ou « ?strings=1 » à la fin de l'URL de la page, par exemple : ''<nowiki>http://monmoodle.fr/course/index.php?strings=1</nowiki>'' ou ''<nowiki>http://monmoodle.fr/course/view.php?id=4&strings=1</nowiki>. Attention : cela ne fonctionne que lorsque l'on est connecté en tant qu'administrateur !
 
== Background ==
 
Moodle is translated into many languages - see [http://download.moodle.org/langpack/ Moodle.org: Language packs] for their list and the translation completion status. The translations are distributed in so called language packages (or just lang packs) that are maintained by kind volunteers, community contributors and Moodle partners. Please read the page [[Translation]] first to understand how the whole localization machinery works.
 
Moodle site administrators can customize any language pack to fit their individual needs (for example to use the term "Unit" instead of "Course"). You are discouraged from direct editing the files coming as a part official language pack. Such changes would be silently overwritten during the next upgrade. Instead, you should create a local language pack that holds all your changes from the official pack.
 
Local language packs have the same structure as the official ones. They are saved in your Moodle data directory in moodledata/lang/xx_local/ folder where 'xx' is the code of the language. You have to have the official language pack installed before you can customize it. Local language pack should contain just strings you have customized - you should not copy whole official language packs.
 
When displaying a string, Moodle first looks if a local customization of it exists in moodledata/lang/xx_local/component_file.php. If so, it is used. If not, the string from the official language pack is used (eventually, if the string has not been translated yet, the original English version is displayed). Please note that the strings are cached for better performance so you have to purge Moodle caches after you modify a file in your xx_local pack (caches are purged automatically if you use the tool described below).
 
== Using Language customization tool ==
 
Moodle comes with a tool that allows you to edit your local language pack via web interface. This tool is available for the site administrators in ''Settings > Site administration > Language > Language customization''. Please refer to the following workflow diagram.
 
[[image:customlang-process.png|800px|thumb|left|Workflow of the language customization (click to enlarge)]]
<br clear="both" />
 
=== Check out strings into translator ===
 
At the Language customization first page, select a language to customize and press the button 'Check out string into translator'. During the checkout, Moodle loads the language strings from PHP files into its database. The language customization tool works with this database so the files in your xx_local pack are not touched unless your proceed to the final step of this workflow. If the xx_local language pack does not exist yet, Moodle automatically creates an empty one for you.
:''Tip:'' There is currently a problem with "execution time". If you get the "Fatal error: Maximum execution time of 180 seconds exceeded" message, you will have to press the button 'Check out string into translator' several times to get the operation completed. See [http://moodle.org/mod/forum/discuss.php?d=163375 forum discussion].
 
=== Use filter to find the strings you want to customize ===
 
[[Image:Language_string_M2_filter.png|thumb|right|Moodle 2.0 language filter]]
After the checkout, use the "filter strings" form to find strings you want to customize for your site. Not selecting any filters will display all strings in the language pack.
 
* ''Show strings of these components'' - Click or Ctrl+click to select one or more files that contain the string you want.
* ''Customized only'' - check this field to display only those strings that are already present in your xx_local pack.
* ''Help only''' - check this field to display only help tooltips, that is the texts used when clicking the yellow question mark icon.
:''Note:'' Starting in Moodle 2.0, help string identifiers must end with _help suffix.
* ''Modified only'' - displays only the strings that are modified in the current session.
:''Note:'' The term 'customized' means strings that are saved on disk in your xx_local pack directory. The term 'modified' represents the changes made since the last checkin string into the language pack. Customized strings (already saved in a file) are highlighted with green. Modified strings (not saved in a file yet) are highlighted with blue.
:''Tip:'' You may want to use this option look at your current work before you check it in.
* ''Only strings containing'' - insert a phrase that must appear in the string. For example, if you put a word 'student' here, you will get only those strings that contain this word.
:''Tip:'' The 'Only strings' filter can be used for a total search for a term used in your Moodle site for the selected language pack.
* ''String identifier'' - if you know the string identifier (it is the first parameter of the get_string() function), type it here. For example, the names of activity modules are defined in strings 'modulename'. Finding where a particular string is saved can be difficult sometimes. The administrator can start a debugging function: Site administration>Development>Debugging and choose "Show origin of language strings". Then if you append "?strings=1" (or "&strings=1" if there is already a parameter) to the end of the page URL, beside each string will be shown something like "{rememberusername/admin}". The last part says which php file uses the string, so this one is in admin.php. If there is nothing after the / look in moodle.php. The first part, before the /, is the string identifier. 
 
Use combination of filter settings to get the required set of strings.
 
Click button 'Show strings' for potential editing.
 
=== Input your own translation ===
 
The strings that pass all the conditions defined in the filter are displayed in a table. To replace the standard translation, put your own into the 'Local customization' field.
:''Tip:''If you want to delete your current customization , just delete the content of the 'Local customization' field and click the "Save and continue editing". The modifications that are going to be removed a customized string are highlighted in red.  If you made changes to a field previously "Save and continue editing" it will be highlighted in blue.
 
Click "Save and continue" button before you change the filter settings and show a new set of strings.
 
=== Saving your work into files ===
 
As necessary, you may repeat the "show strings", "local customization" and "Save and continue" process.  When you have made all the changes you want to make:
 
Click "Save and check in strings into files" to process all changes made in the translator database to your local language pack.
 
=== Writing the modifications into files ===
 
During the checkin, the contents of the translator database are dumped into files in moodledata/lang/xx_local/ directory.
 
Click "Save and check in strings into files" to process all changes made into your local language pack.
:''Note:'' this operation removes the directory first and then re-creates it with the actual data. Therefore it is reasonable to not to touch the files directly after you have checked out them into the translator.
 
==See also==
 
* Using Moodle [https://moodle.org/mod/forum/discuss.php?d=219504 Duplicate entry 'en-373-AM'] forum discussion about error when attempting to edit a lang pack


[[en:Language customization]]
[[en:Language customization]]
[[de:Sprachanpassung]]
[[de:Sprachanpassung]]
[[es:Personalización del idioma]]
[[es:Personalización del idioma]]

Dernière version du 24 novembre 2015 à 09:39

Les mots ou phrases utilisées sur Moodle peuvent être facilement modifiées par un administrateur à l'aide de la fonctionnalité de Personnalisation de la langue. Par exemple, on peut changer le mot « Cours » par « Période ». Le processus comprend 4 étapes :

  1. charger les chaînes de caractères à modifier dans l'interface de modification,
  2. filtrer les chaînes pour afficher les chaînes à modifier,
  3. modifier les chaînes,
  4. enregistrer, pour implanter les chaînes dans votre site.

Instructions rapides pour les impatients

  1. Ouvrir la page Administration > Administration du site > Langue > Personnalisation de la langue.
  2. Sélectionner la langue à modifier dans le menu déroulant.
  3. Cliquer sur le bouton « Ouvrir le paquetage de langue pour modification » et patienter, car cela peut prendre un peu de temps. Cliquer sur « Continuer ».
  4. Sélectionner un ou des fichiers dans l'interface de filtrage des chaînes. Les fichiers sont groupés. On trouve par exemple les fichiers de l'activité Leçon dans « mod » et le fichier moodle.php sous « core ».
  5. Une fois un ou des fichiers sélectionnés, il est possible d'affiner la sélection des chaînes à l'aide d'autres filtres, par exemple « Chaînes contenant ». Cliquer sur « Afficher les chaînes ».
  6. Saisir dans l'interface le texte destiné à remplacer le terme standard. Pour référence, l'original en anglais est également affiché.
  7. Cliquer sur « Enregistrer et continuer les modifications » si vous voulez modifier des chaînes d'autres fichiers.
  8. Cliquer sur « Enregistrer les modifications dans le paquetage de langue » pour enregistrer toutes les modifications effectuées.
Astuce : vous ne voyez pas vos chaînes modifiées ? Avez-vous bien cliqué pour terminer sur le bouton « Enregistrer les chaînes dans le paquetage de langue »? Avez-vous actualisé l'affichage de votre navigateur ? Avez-vous bien modifié la chaîne utilisée dans ce cours ?
Astuce : impossible de trouver la chaîne que vous voulez modifier ? Cochez la case « Afficher l'origine des chaînes de caractères » dans Administration > Administration du site > Développement > Débogage, puis visitez la page contenant la chaîne que vous voulez modifier en ajoutant « &strings=1 » ou « ?strings=1 » à la fin de l'URL de la page, par exemple : http://monmoodle.fr/course/index.php?strings=1 ou http://monmoodle.fr/course/view.php?id=4&strings=1. Attention : cela ne fonctionne que lorsque l'on est connecté en tant qu'administrateur !