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

Translation: Difference between revisions

From MoodleDocs
(rewording)
(rewording (work in progress))
Line 20: Line 20:
== How do language packs work? ==
== How do language packs work? ==


A standard Moodle comes with an English language pack only which is installed in moodledata/lang/en. Extra language packs are normally installed directly from within Moodle from ''Administration>Language>Language packs'' but in some cases you might need to  
A standard Moodle comes with an English language pack only. It is installed in ''moodledata/lang/en.'' Extra language packs are normally installed directly from within Moodle from ''Administration>Language>Language packs'', but in some cases you might need to  
install them via FTP to your moodledata folder into the folder ''lang''.
install them via FTP to your moodledata folder into the folder ''lang''.


The English language terms (or "strings")  for the main (core) Moodle features such as administration, roles etc are stored in ''lang/en.'' Language files relating to modules, blocks and add-ons are stored with the files of that particular module, block or add ons. So if you wanted to see the language strings for the badges block for example you would look in ''blocks/badges/lang/en''. If you wanted to see the language files for the workshop module you would look in'' mod/workshop/lang/en''
The English language terms (or 'strings')  for the main (core) Moodle features such as administration, roles etc, are stored in ''lang/en.'' Language files relating to modules, blocks and add-ons are stored with the files of that particular module, block or add-on. So if you wanted to see the language strings for the badges block for example, you would look in ''blocks/badges/lang/en''. If you wanted to see the language files for the workshop module, you would look in'' mod/workshop/lang/en''




If you install another languge pack, you will then get  a folder  such as lang/fr which would have French translations of Moodle terms. Unlike with English, other language  packs such as  ''lang/fr'' will contain all translations along with the main core terms so you would find see for example the badges strings in lang/fr/block_badges.php and the workshop strings in lang/fr/workshop.php
If you install another languge pack, you will then get  a folder  such as ''lang/fr'' which would have French translations of Moodle terms. Unlike with English, other language  packs such as  ''lang/fr'' will contain all translations along with the main core terms so you would find see for example the badges strings in ''lang/fr/block_badges.php'' and the workshop strings in ''lang/fr/workshop.php''


 
These files (which all end in .php) contain short phrases, often called "strings". Strings may contain a placeholder (between the square brackets below) This placeholder is replaced with the chosen words from the language pack when the string is displayed. The term between the square brackets is called the 'string identifier' or the 'string name'. Examples:
These files (which all end in .php) contain 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 $string. 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';
  $string['hidesection'] = 'Hide section {$a}';
  $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.
If a string hasn't been translated, then Moodle will use the parent language or the original English version. Thus, you might see a Moodle site where some terms have been translated into a language but others still display in English.


==See also==
==See also==

Revision as of 10:56, 19 June 2013

So you'd like to help with translating Moodle?

Great! :-) Please check the list of language packs without maintainer. If your language is listed, and you'd like to volunteer to become language pack maintainer, email our translation coordinator, Koen, translation@moodle.org.

Otherwise, check the Translation credits and contact the maintainer of your language pack to ask where you can help. The name at the top of the list for each language is the current language pack maintainer. (If you don't receive a response within a reasonable time, email Koen translation@moodle.org.)

Getting started

The Moodle languages portal http://lang.moodle.org/ enables translators to work collaboratively on language packs and submit translations using a special Moodle translation tool called AMOS.

To help with translating Moodle

  1. Create an account on the portal, making sure you provide your full name (in order for you to receive credit for your translation work) and contact email.
  2. See the info Help for newcomers.
  3. Access the AMOS translation tool via the link in the navigation block and see the AMOS documentation.

If you have any questions, please enrol in the Translating Moodle course and join the discussions there.

How do language packs work?

A standard Moodle comes with an English language pack only. It is installed in moodledata/lang/en. Extra language packs are normally installed directly from within Moodle from Administration>Language>Language packs, but in some cases you might need to install them via FTP to your moodledata folder into the folder lang.

The English language terms (or 'strings') for the main (core) Moodle features such as administration, roles etc, are stored in lang/en. Language files relating to modules, blocks and add-ons are stored with the files of that particular module, block or add-on. So if you wanted to see the language strings for the badges block for example, you would look in blocks/badges/lang/en. If you wanted to see the language files for the workshop module, you would look in mod/workshop/lang/en


If you install another languge pack, you will then get a folder such as lang/fr which would have French translations of Moodle terms. Unlike with English, other language packs such as lang/fr will contain all translations along with the main core terms so you would find see for example the badges strings in lang/fr/block_badges.php and the workshop strings in lang/fr/workshop.php

These files (which all end in .php) contain short phrases, often called "strings". Strings may contain a placeholder (between the square brackets below) This placeholder is replaced with the chosen words from the language pack when the string is displayed. The term between the square brackets is called the 'string identifier' or the 'string name'. Examples:

$string['addnewcourse'] = 'Add a new course';
$string['hidesection'] = 'Hide section {$a}';

If a string hasn't been translated, then Moodle will use the parent language or the original English version. Thus, you might see a Moodle site where some terms have been translated into a language but others still display in English.

See also