Brickfield Education Labs

Introduction

Plugin Translator by Brickfield 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 Plugin Translator by Brickfield as a local plugin.

Version Support

This plugin is supported for Moodle versions 4.1, 4.4, 4.5, and 5.0.

Deployment

To install the Plugin Translator by Brickfield 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 Plugin Translator by Brickfield local plugin are:

  • DeepL API Key: Enter your DeepL API key, if available, to enable translations.
  • Azure API Key: Enter your Azure API key, if available, 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.

 

Please note that languages must be installed in order to appear in the form’s Target Language dropdown.

 

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

Azure translation documentation
DeepL translation documentation

The Brickfield Translator settings page with the settings: DeepL API Key, Azure API Key, Allow core translations, and Show the "Local test" Translator.

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.

Translating strings for a plugin

The Brickfield Translator submit page with four dropdowns: Select API, Select Plugin, Select Target Language, Select Option Batch Limit, one checkbox: Show existing, and two submit buttons: Translate and Cancel.

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.
    • Multiple plugins may be selected at a time, with each plugin then being processed in turn.
  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. Show existing: tick this if you also want to include pre-existing translation strings, for reviewing purposes.
  7. Click the Translate button.
  8. 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.
  9. PLEASE NOTE: if not saved or downloaded at this point, these strings AND any customisations will be lost and will need to be reprocessed.
  10. 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 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 strings” button to receive a new language PHP file, which can be copied and pasted directly into the plugin’s repository.
  11. 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. Using the “Save Changes as custom language strings” button at the bottom of the table form.

Processing multiple plugins

Plugin Translator by Brickfield 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. Plugin 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: