Note: You are currently viewing documentation for Moodle 2.6. Up-to-date documentation for the latest stable version of Moodle may be available here: Translation.

Translation: Difference between revisions

From MoodleDocs
(→‎Using AMOS translation tool: tuning the entrance of translators for now)
m (Category:Language, rewording)
Line 7: Line 7:
== Summary of changes since 1.x ==
== Summary of changes since 1.x ==


* translations are not in CVS any more but in a database at http://lang.moodle.org
* Translations are not kept in CVS any more but in a database at http://lang.moodle.org
* web interface is used to translate strings
* A web interface is used to translate strings
* all plugins now define their English strings in the plugin folder, as contrib plugins used to
* All plugins now define their English strings in the plugin folder, as contrib plugins used to
* language codes do not have _utf8 suffix any more
* Language codes no longer have a _utf8 suffix
* HTML help files were replaced with normal strings with _help suffix
* HTML help files have been replaced with [[Development:Help strings|strings with a _help suffix]]
* Placeholders must be wrapped in curly braces
* Placeholders must be wrapped in curly braces
* Double quotes should not be escaped any more in the string definition
* Double quotes should not be escaped any more in the string definition
Line 17: Line 17:
== Structure of a Moodle 2.x language pack ==
== Structure of a Moodle 2.x language pack ==


Standard Moodle distribution comes with English language pack only. All other languages must be added to your installation. The English strings for Moodle core (that is the main subsystems like administration, gradebook, roles etc) can be found in ''lang/en/'' folder of your Moodle installation. For example, grading related strings are defined in ''lang/en/grades.php''. All other Moodle components (like activity modules, blocks, enrolment plugins etc) define their own strings in ''lang/en/'' folder within the plugin directory. For example, Workshop module defines its strings in ''mod/workshop/lang/en/workshop.php''.
The standard Moodle distribution comes with English language pack only. All other languages must be added to your installation. The English strings for Moodle core (that is the main subsystems like administration, gradebook, roles etc) can be found in ''lang/en/'' folder of your Moodle installation. For example, grading related strings are defined in ''lang/en/grades.php''. All other Moodle components (like activity modules, blocks, enrolment plugins etc) define their own strings in ''lang/en/'' folder within the plugin directory. For example, Workshop module defines its strings in ''mod/workshop/lang/en/workshop.php''.


Translations are located in your ''moodledata'' directory, in folder ''lang/xx/''. Translations of all the components - both core and plugins - are stored there. For example, the Czech translation of Workshop module would be stored in ''moodledata/lang/cs/workshop.php'' and grading related strings in ''moodledata/lang/cs/grades.php'' (note the difference against the English strings).
Translations are located in your ''moodledata'' directory, in folder ''lang/xx/''. Translations of all the components - both core and plugins - are stored there. For example, the Czech translation of the Workshop module is stored in ''moodledata/lang/cs/workshop.php'' and grade-related strings in ''moodledata/lang/cs/grades.php'' (note the difference against the English strings).


The language files are all with .php extension (eg ''moodle.php'' or ''workshop.php''). These files contains short phrases, often called "strings". Strings may contain a placeholder for variable substitution. The placeholder is replaced with a certain value when the string is actually printed. Strings are stored in PHP array called $strings. The item key in this array is called ''string identifier'' or ''string name''. Examples:
The language files all have a .php extension (eg ''moodle.php'' or ''workshop.php''). These files contains short phrases, often called "strings". Strings may contain a placeholder for variable substitution. The placeholder is replaced with a certain value when the string is displayed. Strings are stored in PHP array called $strings. The item key in this array is called ''string identifier'' or ''string name''. Examples:


  $string['addnewcourse'] = 'Add a new course';
  $string['addnewcourse'] = 'Add a new course';
Line 27: Line 27:
  $string['uploadedfileto'] = 'Uploaded {$a->file} to {$a->directory}';
  $string['uploadedfileto'] = 'Uploaded {$a->file} to {$a->directory}';


These strings definition can be then used by get_string() function (see lib/moodlelib.php). If a string doesn't exist in a particular language, Moodle tries to find it in so called parent language. If there is no parent language defined or it does not define the requested string, then the equivalent in English will automatically be used instead.
These strings definition can be then used by get_string() function (see lib/moodlelib.php). If a string doesn't exist in a particular language, Moodle tries to find it in the so called parent language. If there is no parent language defined or it does not define the requested string, then the equivalent in English will automatically be used instead.


Installation language packs may be found in the ''install/lang'' folder. These language packs contain only the strings needed for the installation process. The files are generated automatically and '''must not be changed manually'''. For translators this is a unusual experience, since changes you add to the strings used in the installation script will not be visible until our script is run and commits them into Moodle sources.
Installation language packs may be found in the ''install/lang'' folder. These language packs contain only the strings needed for the installation process. The files are generated automatically and '''must not be changed manually'''. For translators this is a unusual experience, since changes you add to the strings used in the installation script will not be visible until our script is run and commits them into Moodle sources.


== Using AMOS translation tool ==
== Using the AMOS translation tool ==


Just quick notes for now, to be elaborated more - please help to improve this documentation.  
Just quick notes for now, to be elaborated more - please help to improve this documentation.  


Language pack maintainers can create an account at http://lang.moodle.org and contact translation@moodle.org (Koen) to get their account activated for working on their language. The tool for collaborating on the translation work is not yet in place, so for now only language pack maintainers who have CVS editing rights are granted access. Off course multiple language pack maintainers are possible per langauge - you don't have to do all your work allone. The collaborating tool will allow language pack maintainers to review work from contributors before it is added to the language pack.  
Language pack maintainers can create an account at http://lang.moodle.org and email [mailto:translation@moodle.org translation@moodle.org] (Koen) to get their account activated for working for their language. The tool for collaborating on the translation work is not yet in place, so for now only language pack maintainers who have CVS editing rights will be granted access. Once the collaborating tool is ready, language pack maintainers will be able to review work from contributors before adding it to their language pack.  


The workflow in AMOS is:
The workflow in AMOS is:
Line 43: Line 43:
* '''The stage is destroyed when you logout. You have to explicitly commit the stage so it is saved permanently!'''
* '''The stage is destroyed when you logout. You have to explicitly commit the stage so it is saved permanently!'''
* Language packages are generated every hour and published at http://download.moodle.org/langpack/2.0/
* Language packages are generated every hour and published at http://download.moodle.org/langpack/2.0/
[[Category:Language]]

Revision as of 13:42, 4 July 2010

Template:Moodle 2.0

Moodle 1.x

The following text described the process of Moodle translation for version 2.0 and higher. For Moodle 1.x, please follow Translation.

Summary of changes since 1.x

  • Translations are not kept in CVS any more but in a database at http://lang.moodle.org
  • A web interface is used to translate strings
  • All plugins now define their English strings in the plugin folder, as contrib plugins used to
  • Language codes no longer have a _utf8 suffix
  • HTML help files have been replaced with strings with a _help suffix
  • Placeholders must be wrapped in curly braces
  • Double quotes should not be escaped any more in the string definition

Structure of a Moodle 2.x language pack

The standard Moodle distribution comes with English language pack only. All other languages must be added to your installation. The English strings for Moodle core (that is the main subsystems like administration, gradebook, roles etc) can be found in lang/en/ folder of your Moodle installation. For example, grading related strings are defined in lang/en/grades.php. All other Moodle components (like activity modules, blocks, enrolment plugins etc) define their own strings in lang/en/ folder within the plugin directory. For example, Workshop module defines its strings in mod/workshop/lang/en/workshop.php.

Translations are located in your moodledata directory, in folder lang/xx/. Translations of all the components - both core and plugins - are stored there. For example, the Czech translation of the Workshop module is stored in moodledata/lang/cs/workshop.php and grade-related strings in moodledata/lang/cs/grades.php (note the difference against the English strings).

The language files all have a .php extension (eg moodle.php or workshop.php). These files contains short phrases, often called "strings". Strings may contain a placeholder for variable substitution. The placeholder is replaced with a certain value when the string is displayed. Strings are stored in PHP array called $strings. The item key in this array is called string identifier or string name. Examples:

$string['addnewcourse'] = 'Add a new course';
$string['hidesection'] = 'Hide section {$a}';
$string['uploadedfileto'] = 'Uploaded {$a->file} to {$a->directory}';

These strings definition can be then used by get_string() function (see lib/moodlelib.php). If a string doesn't exist in a particular language, Moodle tries to find it in the so called parent language. If there is no parent language defined or it does not define the requested string, then the equivalent in English will automatically be used instead.

Installation language packs may be found in the install/lang folder. These language packs contain only the strings needed for the installation process. The files are generated automatically and must not be changed manually. For translators this is a unusual experience, since changes you add to the strings used in the installation script will not be visible until our script is run and commits them into Moodle sources.

Using the AMOS translation tool

Just quick notes for now, to be elaborated more - please help to improve this documentation.

Language pack maintainers can create an account at http://lang.moodle.org and email translation@moodle.org (Koen) to get their account activated for working for their language. The tool for collaborating on the translation work is not yet in place, so for now only language pack maintainers who have CVS editing rights will be granted access. Once the collaborating tool is ready, language pack maintainers will be able to review work from contributors before adding it to their language pack.

The workflow in AMOS is:

  • Use the Translator filter to show strings you want to work on
  • Translate missing strings and/or update the translation
  • The translated strings are put into a temporary area called stage
  • The stage is destroyed when you logout. You have to explicitly commit the stage so it is saved permanently!
  • Language packages are generated every hour and published at http://download.moodle.org/langpack/2.0/