Brickfield Education Labs

Introduction

Brickfield Translator enables the translation of plugin language strings, via the usage of multiple translation APIs, including DeepL and Azure.

 

Translation results are displayed as a comparison table between the English strings and the new language strings. These strings can then be either saved as custom language strings or downloaded as ready-to-go PHP strings for inserting into plugin language files.

Administration

This section is for the administration of the Brickfield Translator local plugin.

Version Support

This plugin is supported for Moodle versions 4.01, 4.02, 4.03, 4.04, and 4.05.

Deployment

To install the Brickfield Translator local plugin (local_bftranslate):

  1. Unzip and copy the bftranslate folder into Moodle’s local/ folder.
  2. Go to Site administration > Notifications to install the tool.

 

Further installation instructions can be found on the Installing plugins Moodle documentation page.

Configurations

The configurations of the Brickfield Translator local plugin are:

  • DeepL API Key: Enter your DeepL API key to enable translations.
  • Azure API Key: Enter your Azure API key to enable translations.
  • Allow core translation: Switch between translating core or non-core plugins. 
  • Show the “Local test” translator: Display the local test option, which allows Brickfield Translator to demonstrate usage without API connections.
  • External Plugins: Enter a comma separated list of installed external plugins.

Capabilities

Capability name Manager Teacher Student Auth user
local/bftranslate:viewall Prevent

Viewall capability

The capability “local/bftranslate:viewall” allows users with the relevant permissions for that context to view the translations page.

 

This capability is not granted by default to any archetype roles, due to its interactions with the language storage, which is an essential part of the Moodle system.

Copyright and funding

Brickfield Translator has been developed, maintained, and is copyrighted by Brickfield Education Labs.

Usage as Site administrator

This section is for usage of the Translator plugin as a site administrator.

Setting up Brickfield Translator

To set up Brickfield Translator:

 

  1. Navigate to Site administrator > Plugins > Plugin Translator > Settings.
  2. Enter your DeepL API key to the “DeepL API Key” setting.
  3. Enter your Azure API key to the “Azure API Key” setting.
  4. Click the “Save changes” button.

 

Please note that languages must be installed in order to appear in the Target language dropdown.

 

For more information on DeepL and Azure APIs, please see:

Translating strings for a plugin

The Brickfield Translator submit page with four dropdowns: Select API, Select Plugin, Select Target Language, Select Option Batch Limit.

Translation steps

To translate the strings for a plugin:

  1. Navigate to Site administrator > Plugins > Plugin Translator > Translation page.
  2. Select an API to use in the “Select API” dropdown.
  3. Select a plugin to translate in the “Select Plugin” dropdown.
    • If a plugin that you would like to translate is not listed, please reference the steps further down for adding support for a new plugin.
  4. Select the output language in the “Select Target Language” dropdown.
    • Languages will only appear as options if the language packs are installed on the Moodle site.
  5. Leave the batch limit at 0 to process all strings, unless a batch limit is required with a large amount of strings to be processed.
  6. Click the Translate button.
  7. The page will now display the original and translated strings for comparison.
    • The new target language strings will be in editable fields.
    • This allows a user to review the strings supplied by the Translation API, and to edit and update them as needed.
  8. PLEASE NOTE: if not saved or downloaded at this point, these strings AND any customisations will be lost and will need to be reprocessed.
  9. The user now has two options to continue with:
    1. Click the “Save Changes as custom language strings” button. This will save the strings, including any edits, into the correct area of the Moodle site, where language customisations are all stored.
      1. The Moodle site language string cache will need to be purged at this point.
      2. The translation strings are instantly active for usage, and also ready to be managed via all the standard core Moodle language pack processes as well.
    2. Click the “Download as PHP language string” button to receive a new language PHP file, which can be copied and pasted directly into the plugin’s repository.
  10. The processing of language strings is able to correctly handle the following:
    1. Moodle placeholders for any dynamic values.
    2. Any HTML tags included.

Translating a plugin in batches is more complicated, but available if needed, for instance if the plugin has a very large amount of strings:

 

  1. Run the relevant translation process with the batch amount you need.
  2. Save the produced translation language strings, either:
    1. Into the plugin lang file directly as a plugin developer, or.
    2. Via the customisation function in Site administration > Language > Language customisation > Open language pack for editing, or.
    3. Using the “Save Changes as custom language strings” button at the bottom of the table form.
  3. Remember to purge caches for language strings, as the cache needs refreshing, to find the saved strings, in order to see them as done and use the next batch of strings in the plugin to process next.

Adding support for translating a plugin

To add support for translating a plugin that is not listed by default:

  1. Navigate to Site administrator > Plugins > Plugin Translator > Settings.
  2. Add the plugin’s correct component name to the “External Plugins” setting, in the format of a comma separated list.
  3. Click the “Save changes” button.

Processing multiple plugins

Brickfield Translator also allows you to submit and process multiple plugins:

  1. Follow the same steps as for the “Translation steps” section above.
  2. However, instead of selecting a single plugin, select multiple plugins from the “Select Plugin” dropdown.
  3. Brickfield Translator will process each submitted plugin, one at a time.

Currently supported languages

For more information on supported languages by DeepL and Azure APIs, please see: