Table of Contents
DeepL Autotranslate Plugin
Compatible with DokuWiki
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" yes
- 2018-04-22 "Greebo" unknown
- 2017-02-19 "Frusterick Manners" unknown
To use the plugin, the following page/namespace structure is required:
- The page with the name
foo:barin the language [ISO-Language-Code]
- The original page with the name
foo:barin your default language
So for example if your default language is german and you have a namespace for english translations:
- Your default german landing page
- The english translation of the landing page
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:startand 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).
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).
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.
You can use DeepL glossaries to specify a specific translation for specific words. To use this feature, set the namespace for the definitions of the glossaries (e.g.
internal:glossaries). When you create the start-page of the glossary definition namespace (e.g.
internal:glossaries:start), a template for this page is pasted to your editor. This template contains all supported glossary language pairs for your default language and links to their definition pages.
When you create a glossary definition page (e.g.
internal:glossaries:en_de for the EN → DE glossary), a template for a glossary definition page will be pasted to your editor. You can modify the template as you want, but the important thing is: the glossary entries will be generated from the first two table columns (body only) on this page. So you can add more columns if you want and they won't affect the glossary definitions. Caution: the first two columns of all tables on this page will be used to generate the glossary entries.
When you remove all entries from the table or delete the definition page, the glossary will be deleted.
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)
- Optional: Default operating mode
- Set the default operating mode (see explanation above)
- 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: Glossary namespace
- A DokuWiki namespace that contains the definition of DeepL glossaries (see above)
- 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
- 2022-09-15: prevented deepl from destroying the syntax when a whole line is formatted
- 2022-09-11: added a feature to use DeepL glossaries for the translations
- 2022-06-05: prevented interwiki and windows share links from being affected by patch_links and to keep the alignment of media in patch_links
- 2022-06-04: prevented plugin embeds from being affected by patch_links and added perm check to when to show the push translation button
- 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
- 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
phpto 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