Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

Translation: diferència entre les revisions

De MoodleDocs
Salta a:navegació, cerca
m (→‎Using the AMOS translation tool: added a workflow diagram)
(copied from 2.5 docs)
 
(26 revisions intermèdies per 8 usuaris que no es mostren)
Línia 1: Línia 1:
{{Moodle 2.0}}
{{Language}}
==So you'd like to help with translating Moodle?==


== Moodle 1.x ==
Great! :-) Please check the [[dev:Language packs without maintainer|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, [mailto:translation@moodle.org translation@moodle.org].


The following text described the process of Moodle translation for version 2.0 and higher. For Moodle 1.x, please follow [[Translation]].
Otherwise, check the [[:dev:Translation credits|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 [mailto:translation@moodle.org translation@moodle.org].)


== Summary of changes since 1.x ==
==Getting started==


* Translations are not kept in CVS any more but in a database at http://lang.moodle.org
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''.
* 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 [[Development:Help strings|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 ==
To help with translating Moodle


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''.
# [http://lang.moodle.org/login/signup.php 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.
# See the info [http://lang.moodle.org/mod/page/view.php?id=9 Help for newcomers].
# Access the AMOS translation tool via the link in the navigation block and see the [[AMOS|AMOS documentation]].


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).
If you have any questions, please enrol in the [http://lang.moodle.org/course/view.php?id=2 Translating Moodle course] and join the discussions there.


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 $string. The item key in this array is called ''string identifier'' or ''string name''. Examples:
== How do language packs work? ==


$string['addnewcourse'] = 'Add a new course';
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
$string['hidesection'] = 'Hide section {$a}';
install them via FTP to your moodledata folder into the folder ''lang''.
$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.
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''


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


Just quick notes for now, to be elaborated more - please help to improve this documentation.
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:


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.
$string['addnewcourse'] = 'Add a new course';
 
$string['hidesection'] = 'Hide section {$a}';
AMOS provides support for community contributions into the translation. If you want to participate, just create an account at http://lang.moodle.org. There is no need to contact Koen in this case but you should definitely contact the language maintainer and coordinate your work.
 
=== Basic concepts ===
 
AMOS consists of several tools available via the main navigation block - Translator, Stage, Stashes and Log.
 
* Translator - is a tool that allows you to filter strings you want to work on and translate them
* Stage - is a temporary are that holds the strings you have translated during the current session
* Stashes - are snapshots of the stage. Imagine them as ordinary files at your computer where you can save your work. You can share your stash with the language pack maintainers via so called pull request.
* Repository - a database of all Moodle strings and their history running at lang.moodle.org server
* Log - displays the log of all modifications of Moodle strings.
 
[[image:amos-workflow.png]]
 
=== Using Translator ===
 
Use the Translator filter to show strings you want to work on. You have many options of filtering. You can work on a single component or all missing strings at once. You can search for strings containing a given text (either in English or the translated string) etc. You can check for strings in older versions, too but those strings are read-only. They get automatically pulled into AMOS from the CVS repository.
 
Click the Translation field to turn it into editable field and put the translation there. Click outside the field to stage your translation.
 
=== Using Stage ===
 
The translated strings are put into a temporary area called ''stage'' immediately after the cursor leaves the editor field. The stage holds your work before it is either committed into the repository (if you are language pack maintainer) or is stashed and offered to the maintainers for inclusion.
 
The stage is destroyed when you logout. You have to explicitly commit or stash the stage so it is saved permanently. If you forget to do it, or there is a problem with the connectivity, your browser crashes or whatever, you can find your most recent snapshot of the stage in AUTOSAVE stash.
 
If you are language pack maintainer, you can commit the stage into the repository so your work is registered and the translated strings become part of the official language package. Language packages in ZIP format are generated every hour (at 45 mins) and are published at http://download.moodle.org/langpack/2.0/. At the same time, they become available for Moodle sites for automatic update.
 
=== Using Stashes ===
 
At any moment, you can save a snapshot of the current stage. We call such snapshot a ''stash''. Stashed strings are kept forever until you drop them manually (please do not abuse this and keep your stashes reasonable big). The stash can be ''applied'' so that the stashed strings are copied back to the stage.
 
Your stash can be also offered to the official language pack maintainers for inclusion into the repository. Once you have a bulk of translation finished in your stage, just stash it and create ''pull request''. This will mark the stash as available for the maintainers and they will be able to apply it into their stage, review your work and eventually commit it. Please note that the maintainers are not sent any notification on new pull requests (this is intentional to prevent spamming). Just use either Moodle messaging subsystem or direct email to inform the maintainer about the pull request. We believe that all contributors should be in contact with the official maintainer anyway and AMOS should not try to replace this kind of communication.
 
Your pull request is available to the maintainers of all languages that your stash modifies. Once you receive a confirmation from the maintainers that your work has been accepted, you should drop the offered stash.


There is one special stash record for every user called AUTOSAVE. This stash keeps the most recent state of the stage. You may find it useful if you loose the current stage for any reason - your browser crashes, your internet connectivity dies or you accidentally unstage all strings. If that happens, just apply the AUTOSAVE stash to get your work back. The AUTOSAVE stash is updated every time you stage a string. So if your stage is empty and your AUTOSAVE is full of strings and you go into the Translator first without applying the stash, the AUTOSAVE will be replaced with the new translated string. We recommend to experiment a bit with this feature first.
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.


=== Using Log ===
==See also==


This tool is not fully implemented yet. There will a filter that will allow to search for string modifications in a similar manner as in the Translator filter.
* [[Translation priority]] - a useful list categorising the priority in which strings should be translated.
* [[Translation FAQ]]
* [[dev:Translation langconfig|Settings in langconfig]]


[[Category:Language]]
[[fr:Traduction]]
[[de:Übersetzung]]
[[es:Traducción]]

Revisió de 11:13, 19 juny 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