Content translations

Filters ::: filter_translations
Maintained by Andrew Hancox, RTRajneel Totaram
A filter which allows automatic and manual translation of content.

Content translations 1.0

Moodle 3.9, 3.10, 3.11, 4.0
Released: antradienis, 2022 liepos 19, 21:03

This plugin is part of a set, which also includes Moodle Atto Translations

Full documentation available at: https://docs.moodle.org/311/en/Content_translation_plugin_set

To Install it manually

To Enable it

  • Go to "Site Administration >> Plugins >> Filters >> Manage filters" and enable the 'Content translations' plugin there.
  • Go to "Site Administration >> Plugins >> Filters >> Content translations" and choose a caching level appropriate to your site.

Cacheing

Since the filter makes database calls and, if Google Translate is enabled, web service calls, it is advisable to enable caching by working with the cachingmode setting. If you have a small volume of course material in active use then Application mode caching is advised, if you have a large volume then Session. In any case, the default of Request is rarely the optimal choice.

How it chooses translations

  • Get a prioritised list of the languages we could translate into - starting with the user's preferred language, then working through parent languages.
  • Get the translation(s) that fit the highest priority language.

  • If a span tag with an MD5 key in the data-translationhash property and a translation with a matching md5key can be found then use that one.

  • Otherwise, if a translation can be found which has an MD5 key matching the MD5 hash of the content then use that.
  • Finally, if a translation has a 'last generated hash' (meaning the MD5 hash of the content it was last updated in reference to) which matches the MD5 hash of the content then use that.

To Use it

Users with the 'filter/translations:edittranslations' capability will see an icon in the top right hand corner of the screen to enable the translator view of the course. At this point all translatable text will have an icon injected next to it to allow it to be translated.

To migrate from filter_fulltranslate

A CLI tool is available to migrate all translations across from the filter_fulltranslate.

It is recommended that you clean out any unwanted translations that may have been generated as follows:

delete from mdl_filter_fulltranslate where sourcetext like '%{mlang%';

You can then copy the translations from filter_fulltranslate into filter_translations as follows:

php cli/migrate_filter_fulltranslate.php --confirm

To add translation span tags to existing data

A CLI tool is available to automatically add span tags to existing data. Please use with extreme caution.

You can run the tool as follows which will show help text:

php cli/insert_spans.php

Author

The module has been written and is currently maintained by Andrew Hancox on behalf of Open Source Learning.

Useful links

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Version information

Version build number
2022042709
Version release name
1.0
Maturity
Stabili versija
MD5 Sum
cd6b476dee0704a1af59e9baf1f75952
Supported software
Moodle 3.9, Moodle 3.10, Moodle 3.11, Moodle 4.0
  • The more recent release 2023031010 exists for Moodle 3.9
  • The more recent release 2023031010 exists for Moodle 3.10
  • The more recent release 2023031010 exists for Moodle 3.11
  • The more recent release 2023031010 exists for Moodle 4.0

Version control information

Version control system (VCS)
GIT
VCS repository URL
VCS branch
main
VCS tag
v1.0

Default installation instructions for plugins of the type Filters

  1. Make sure you have all the required versions.
  2. Download and unpack the filter plugin.
  3. Place the folder (eg "myfilter") in the "filter" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation