Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Translation.

Translation: Difference between revisions

From MoodleDocs
(Links still need doing from original file)
 
(category, titles, formatting)
Line 1: Line 1:
Moodle has been designed for internationalisation. Each 'string' or 'page' of text that is displayed as part of the interface is drawn from a set of language files. Each language is a subdirectory of the directory 'lang'. The structure of the lang directory is as follows:
Moodle has been designed for internationalisation. Each 'string' or 'page' of text that is displayed as part of the interface is drawn from a set of language files.  


'''lang/en''' - directory containing all files for one language (eg English)
== Directory structure of lang ==


* moodle.php - strings for main interface
Each language is a subdirectory of the directory ''lang''.
* assignment.php - strings for assignment module
 
* choice.php - strings for choice module
''lang/en'' is the directory containing all files for English.
* forum.php - strings for forum module
 
* quiz.php - strings for quiz module
* ''moodle.php'' - strings for main interface
* resource.php - strings for resource module
* ''assignment.php'' - strings for assignment module
* survey.php - strings for survey module
* ''choice.php'' - strings for choice module
* ''forum.php'' - strings for forum module
* ''quiz.php'' - strings for quiz module
* ''resource.php'' - strings for resource module
* ''survey.php'' - strings for survey module
* .... plus other modules if any.
* .... plus other modules if any.


:A string is called from these files using the get_string() or print_string() functions. Each string supports variable substitution, to support variable ordering in different languages.
A string is called from these files using the <code>get_string()</code> or <code>print_string()</code> functions. Each string supports variable substitution, to support variable ordering in different languages.


:eg $strdueby = get_string("assignmentdueby", "assignment", userdate($date));
e.g. <code>$strdueby = get_string("assignmentdueby", "assignment", userdate($date));</code>


:If a string doesn't exist in a particular language, then the equivalent in English will automatically be used instead.
If a string doesn't exist in a particular language, then the equivalent in English will automatically be used instead.


'''lang/en/help''' - contains whole help pages (for popup context-sensitive help)
*''lang/en/help'' contains whole help pages for pop-up context-sensitive help.


:Main help pages are situated here, while help pages specific to each module are located in subdirectories with the module's name.
Main help pages are situated here, while help pages specific to each module are located in subdirectories with the module's name.


:You can insert a helpbutton in a page with the helpbutton function.
== Help buttons ==


:eg helpbutton("text", "Click here for help about text");
You may insert a help button in a page with the helpbutton function.


:and for modules:
e.g. <code>helpbutton("text", "Click here for help about text");</code> , and for modules, <code>helpbutton("forumtypes", "Forum types", "forum");</code>


:helpbutton("forumtypes", "Forum types", "forum");
== Language editing ==


Note that you can edit languages online, using the administration web tools under "Check this language". This makes it easy to not to only create new languages but to refine existing ones. If you are starting a new language, please contact me, Martin Dougiamas.
Please note that you may edit languages via Administration >> Configuration >> [[Admin/lang | Language]]. This makes it easy to not only create new languages but to refine existing ones. If you are starting a new language, please contact Martin Dougiamas. You may also like to post in the [http://moodle.org/mod/forum/view.php?id=43 Using Moodle: Languages] forum.


You might also like to post in the Languages forum on Using Moodle.
[[Category:Developer]]
If you are maintaining a language an ongoing basis, I can give you CVS write access to the Moodle source code so that you can directly maintain the files.

Revision as of 07:11, 20 December 2005

Moodle has been designed for internationalisation. Each 'string' or 'page' of text that is displayed as part of the interface is drawn from a set of language files.

Directory structure of lang

Each language is a subdirectory of the directory lang.

lang/en is the directory containing all files for English.

  • moodle.php - strings for main interface
  • assignment.php - strings for assignment module
  • choice.php - strings for choice module
  • forum.php - strings for forum module
  • quiz.php - strings for quiz module
  • resource.php - strings for resource module
  • survey.php - strings for survey module
  • .... plus other modules if any.

A string is called from these files using the get_string() or print_string() functions. Each string supports variable substitution, to support variable ordering in different languages.

e.g. $strdueby = get_string("assignmentdueby", "assignment", userdate($date));

If a string doesn't exist in a particular language, then the equivalent in English will automatically be used instead.

  • lang/en/help contains whole help pages for pop-up context-sensitive help.

Main help pages are situated here, while help pages specific to each module are located in subdirectories with the module's name.

Help buttons

You may insert a help button in a page with the helpbutton function.

e.g. helpbutton("text", "Click here for help about text"); , and for modules, helpbutton("forumtypes", "Forum types", "forum");

Language editing

Please note that you may edit languages via Administration >> Configuration >> Language. This makes it easy to not only create new languages but to refine existing ones. If you are starting a new language, please contact Martin Dougiamas. You may also like to post in the Using Moodle: Languages forum.