This is an old revision of the document!
Table of Contents
DeepL Autotranslate Plugin
Compatible with DokuWiki
- 2024-02-06 "Kaos" unknown
- 2023-04-04 "Jack Jackrum" unknown
- 2022-07-31 "Igor" unknown
- 2020-07-29 "Hogfather" yes
This plugin automatically creates translations based on the Translation plugin page structure using the DeepL API.
Installation
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Examples/Usage
Page structure
To use the plugin, the following page/namespace structure is required:
[ISO-Language-Code]:foo:bar
- The page with the name
foo:bar
in the language [ISO-Language-Code]
foo:bar
- The original page with the name
foo:bar
in your default language
So for example if your default language is german and you have a namespace for english translations:
start
- Your default german landing page
en:start
- The english translation of the landing page
Operating Modes
The plugin has two operating modes: the direct mode and the editor mode:
- direct mode: missing translation pages will automatically be created if you visit it. So for example if you visit
en:start
and it does not exist it will be translated automatically and the translation will be shown directly. - editor mode (default): missing translation pages won't be created by simply visiting it, instead when you open the editor on a missing translations page, the auto-translated page will be pasted in the editor that you can edit and save it.
You can configure the default operating mode in the plugin settings. You also can define a regex for page names that should always be handled in a specific mode. Additionally you can define a blacklist regex for page names that should never be auto translated. You can define expressions (words) in texts that should never be translated (abbreviations for example).
Retranslation
If you want to retranslate a page, simply delete it and then it will be created again with your specified operating mode. You can also use the retranslate button in the side menu if you have not disabled it (it is enabled by default).
Push translations
There also is a so called push translation feature in which you can configure languages to which you want to push your translations from the pages in the original language. If you have configured at least one language for which you want to use push translations and the retranslate button is not disabled, the button will also be displayed on the pages in the original language. When you press the button on the page in the original language, it will be translated into all the languages configured for push translations.
Links and Media
When a page in the original language links to pages or media that also exist in the target language, the links also point to the target in the target language. If the link target does not exist in the target language, it continues to point to the one in the original language. The corresponding link texts are also translated by DeepL.
Configuration and Settings
You can configure the following settings:
- Required: API-Key
- Your Key for the DeepL API
- Optional: API
- The DeepL-API for which your key is valid
- Free-API (default)
- Pro-API
- Optional: Default operating mode
- Set the default operating mode (see explanation above)
- direct-mode
- editor-mode (default)
- Optional: Show translate button
- If enabled, it shows a button to force a (re)translation of pages in language namespaces
- Default: enabled
- Optional: Push languages
- A space-separated list of languages (ISO codes) for which translations are created when the Translate button on the original page is pressed
- The translation button is only shown on the original pages when at least one push language is given
- Optional: Blacklist regex
- A regular expression which matches page names that should never be translated automatically
- Optional: Direct regex
- A regular expression which matches page names that should always be translated in the direct-mode
- Optional: Editor regex
- A regular expression which matches page names that should never be translated in the editor-mode
- Optional: Ignored expressions
- Expressions or words that shouldn't be translated. Separated by
:
. Useful for abbreviations.
- Optional: Default language is in a language namespace
- For example if your default language is German (de) and your German pages are in the
de:
namespace, you should enable this setting - This is usually not needed as the pages for the default language are usually not in a separate namespace
Changelog
- 2022-06-04: prevented plugin embeds from being affected by patch_links and added perm check to do push translation
- 2022-05-30: updated the link patching feature so that it always replaces relative links with absolute links after translation
- 2022-05-29: prevented deepl from messing with tables and links in wikitext (outside of
[[ ]]
) - 2022-05-25: bug fixes
- 2022-05-24:
- added option for default language is in a language namespace
- added feature for translating link text
- added feature for pointing links to already existing pages in the language namespace
- fixed direct translation
- fixed that DeepL breaks the DokuWiki syntax with unknown XML Tags
- 2022-05-10: fixed ignore of file and code tags
- 2022-05-09: added button for (re)translations and added output messages from plugin actions
- 2021-12-15: added DokuWiki builtin-tags
code
,file
andphp
to the translation-ignore-tags to prevent the translation of the contents in those tags - 2021-12-14: changed from curl to the builtin DokuWiki HTTPClient
- 2021-12-11: first version