
Table of Contents
Introduction
This article explains a procedure for translating the content of a course developed on Moodle, the open-source LMS (Learning Management System). Even though its interface is available in over 100 languages, Moodle has no out-of-the-box tools for translating course content.
The solution proposed here is summarized in the following 5 steps:
- exporting the course via Moodle’s backup feature
- converting the relevant content to XLIFF
- translating these XLIFFs externally
- converting them back to XML
- restoring the translated package as a new course.
Elements to be translated
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, system messages, and all the other programming strings are included in the Language Packs. Currently, there are over 100 languages available.
If you want the course to be in a specific language, the first step is to download the corresponding package. Those unfamiliar with this process can consult the Frequently Asked Questions Related to Moodle Translation.
The files uploaded to Moodle (from version 2.0) are given an SHA1 hash value, which 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 following your usual workflow, and finally upload the translated files once the rest of the content is already translated.
The final element consists of the actual content of the course.
Moodle does not (yet) provide a convenient way to translate courses. Yes, there is the Multi-language content filter, but it is a solution that forces the course creator to enter content in the various languages within the same course, a cumbersome process that is difficult to manage and automate. Another option is a recent plugin offered by Alconost, but this is a third-party solution that acts as a tie-in with Crowdin and, in effect, forces you to depend on this company for translations.
Until Moodle offers a more agile feature designed to have a course in multiple languages, the solution we propose takes advantage of exported XML files for backup purposes, which can be converted to XLIFF through Okapi Framework, and specifically Rainbow. XLIFF is one of the standard formats for localisation. It can be opened with OmegaT or other assisted translation 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
- Access Moodle as an administrator
- Click on the course you want to translate
- Go to Administration → Course administration → Backup
- Follow this procedure: https://docs.moodle.org/311/en/Course_backup;
- 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 will have the MBZ extension. This is a compressed file including all course elements as XML files and all other files related to the course.
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 programme used to convert the XML to XLIFF. This conversion is not strictly necessary, because most translation tools can open XML directly.
We created a filter including all the elements that should be translated in an average course. The configuration file can be downloaded here. Further informtion about creating filters is available at 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 for converting one file format to another with Okapi Rainbow can be found at 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.
Translation
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. Using OmegaT gives you the advantage of having the “post-processing hook” feature: when creating the target files, these 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 .
Conversion from XLIFF to XML
If you are not using OmegaT for the translation, you need to reopen 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): https://docs.moodle.org/311/en/Course_restore. Make sure that you’re restoring the course as a new course and you’re not overwriting an existing one.
Note: 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.
Final check
After the process is complete, check the language settings (see https://docs.moodle.org/311/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.
Consulting for the translation of training courses developed in Moodle is one of the services we offer at Qabiria: Contact us if you need help.