How to translate a Moodle course in 2019

How to translate a Moodle course in 2019

This article explains a procedure for translating the content of a course developed in Moodle, the open-source LMS (Learning Management System). Although its interface is available in over 100 languages, Moodle doesn't have any out-of-the-box tools for course translation. We suggest a workaround consisting of the following 5 main steps:

  1. exporting the course via Moodle's backup feature
  2. converting the relevant content to XLIFF
  3. translating these XLIFFs externally
  4. converting them back to XML, and
  5. restoring the translated package as a new course.

In order to fully translate a Moodle course, you need to translate several elements:

  • the interface
  • system messages
  • course content
  • files (images, videos, attached documents, etc.)

The interface, the system messages and all other strings of the core system are included in the Language Packs. Currently, there are over 100 languages available. If you want your course in a specific language, the first step is to download the corresponding language pack. We suppose you're familiar with this task, otherwise check https://docs.moodle.org/37/en/Language_FAQ. Recently, a translation site has been introduced, that enables translators to work collaboratively on language packs using a special Moodle translation tool called AMOS.

The files that are uploaded into Moodle (from version 2.0) are given an SHA1 hash value that is used as the basis to store the file. Without going into too much detail, this behaviour has several technical advantages, but it also makes it more difficult to read and edit the files by looking at the exported backup directory where files are stored. We recommend downloading the files to be translated from Moodle instead, translate them offline in line with your usual workflow, and finally upload the translated files once the rest of the content is already translated.

The last element is the course content. Moodle doesn't provide a way to translate courses (yet), and until a proper feature is offered by Moodle, our workaround leverages the XML files that are exported for backup purposes and can be converted to XLIFF via Okapi Rainbow. XLIFF is a standard localization format that can be opened in OmegaT or other computer-aided translation (CAT) tools. After the translation phase, the last step is to import the course back to Moodle using the Restore function.

How to export a Moodle course to XML

  1. Access Moodle as an administrator
  2. Click on the course you want to translate
  3. Go to Administration > Course administration > Backup
  4. Follow this procedure: https://docs.moodle.org/37/en/Course_backup
  5. Select activities, blocks, and all other items you want to translate and then click the Next button. Do not include data specific to the course history, such as users, user information, user role assignments, groups, groupings, user files, comments, user completion details, course logs and grade history in the backup.

The exported file is an MBZ file, which is a compressed file including all course elements as XML files and all other files related to the course.

directory2

How to filter the translatable elements of a Moodle course

In order to translate the course content in a CAT tool, you first need to identify the XML elements that are translatable. Then, create a filter in Okapi Rainbow, the program used to convert the XML to XLIFF. This conversion is not strictly necessary, because most translation tools can open XML directly. However, converting XML into XLIFF is recommended for several reasons:

  • If you're translating your Moodle course into several languages, you only have to prepare / convert the XML once, not relying on each translator to correctly configure the tool.
  • Converting from XML to XLIFF gives you control over which XML elements must be translated.
  • If you're outsourcing the translation, sending the XLIFF files allows each translator to choose the translation tool of their choice.
  • If you want to use an open-source and free tool, OmegaT, this step is necessary, because OmegaT can't open Moodle XML files directly.

We created a filter including all the elements that should be translated in an average course. You can download the filter here. Further information about filter creation can be found on http://okapiframework.org/wiki/index.php?title=XML_Filter. Course administrators might want to add further elements to the filter by editing it accordingly.

Conversion from XML to XLIFF

General instructions to convert one file format into another with Okapi Rainbow can be found on http://okapiframework.org/wiki/index.php?title=How_to_Extract_Text_for_Translation. There are a few details that you must pay attention to:

  • You should use the XML filter, not the XML Stream filter.
  • If you're using OmegaT as a CAT tool, you should choose the “OmegaT Project” option in the Package Format tab, leaving the default options. The “Include post-processing hook” setting is very important: it will allow you to create the return package automatically.
  • If you're using another CAT tool, then select the “Generic XLIFF” option in the Package Format tab.
  • Make sure the Filter Configuration is not set (set to <None> in the Input Document Properties dialog), if you want Rainbow to ignore some files. They will be copied to the working folder and later to the final folder, but they will not be converted/processed. This is especially useful if you have media files in your course, which can't be translated with this procedure.

Rainbow

How to translate your Moodle course contents with a translation tool

The output of the conversion process is either an OmegaT project package or a directory with XLIFF files. The first one can be opened in OmegaT, the free and open-sourced translation tool, as is. The XLIFF files can be opened in the vast majority of other CAT tools. Please refer to the Help documentation of the CAT tool of your choice for further details.

Using OmegaT gives you the advantage of having the post-processing hook feature: when you create the target files, they will be converted back to XML automatically, therefore skipping the next step. In order to do so, you the “Also allow per-project external commands” option in Options > Saving and Output Options should be selected.

Options

Conversion from XLIFF to XML

If you haven't used OmegaT for translation, you need to go back to Rainbow and follow this procedure: http://okapiframework.org/wiki/index.php?title=How_to_Post-Process_Extracted_Text. The output of this step is a folder containing the translated XML and all the files/folders that you marked as non-translatable in the initial conversion step. You can now zip the whole directory to be imported back into Moodle.

How to import your translated Moodle course back into Moodle

In order to import the course back into Moodle, you need to use the Restore feature (not the Import feature, which is used to copy content from one course to another). Follow this procedure: https://docs.moodle.org/37/en/Course_restore.

Make sure that you're restoring the course as a new course and you're not overwriting an existing one.

Please note that your hosting provider might prevent you from importing new files larger than the server's file size limit. If you've installed Moodle on a shared hosting there's little you can do about it. Our suggestion is to reduce zip file size by deleting one or more media file folders.

backupRestore

Don't forget to do a final review your translated Moodle course in context

Once you're done, check the language settings (see https://docs.moodle.org/37/en/Language_settings). You can force Moodle's interface language to be the same as the new course target language (i.e., if you have translated your course to Spanish, you can force Moodle to be shown in Spanish).

At this point, you need only review the whole course and double-check that everything is translated. We can't guarantee that the sample filter provided above will expose each and every translatable element, so it's important that you perform this final check before publishing the course.

If you're unsure about any of the steps above, please use the Comments section to ask us about it. Also, consider us to help you translate your Moodle training course.

Get in touch with us for a non-binding quote

Qabiria white logo

We believe in the creative use of technology to enhance productivity.

Proud members of:

PIMEC's logo

LATEST NEWS

Contact us

Qabiria Studio SLNE
Carrer Lleida, 3 1-2
08912 Badalona
(Barcelona)
SPAIN

+34 675 800 826

qabiria

Send us a message

Get our Newsletter

Would you like to read Qabiria articles and news right in your inbox?