Weblication® provides you with a one-click language translation via an DeepL interface as an additional module.
The module requires a valid subscription to the DeepL-API and certain Weblics® in the current version (heading, body text).
This function enables care users to translate various texts (in WYSIWYG fields, navigation text fields, text modules, form fields) into the corresponding language of the currently edited language version with a click of the mouse.
The languages supported by the DeepL-API are listed in the DeepL-API documentation.
First activate the module via the Weblication® CMS license and then enter the DeepL key, which you received as a subscriber from DeepL, in the project configuration. In BASE (Mobile First) projects, the mask is already prepared accordingly.
... <variable description="DeepL API-Schlüssel" key="deepl_key">Ihr-DeepL-API-Key</variable> <info>Im Editor erscheint beim Klick in ein Textfeld eine Schaltfäche zum Übersetzen in die entsprechende Projektsprache. Einen Schlüssel zur Nutzung des Übersetzungsdienstes erhalten Sie auf https://deepl.com<br/>Beim Einsatz von <a href="https://support.deepl.com/hc/de/articles/360021200939-DeepL-API-Free" target="_blank">DeepL API Free</a> setzen Sie vor den DeepL API-Schlüssel folgendes Prefix: free:</info> <headline text="Editor"/> ...
When using the free DeepL-API Free, place the following prefix in front of the DeepL API key:
free:
When editing the pages of a language project, the status bar displays a button for translating the current page (e.g. /en/index.php) in addition to the other languages.
By clicking on "Translate this page automatically", the text directly available in the page is transferred to the DeepL interface together with the target language. After a short time, the existing text is replaced by the translated text and the page editing is reloaded. The language of the source text is automatically recognized by the DeepL API.
The most important languages are currently supported.
It is also possible to have only individual elements translated, which is described below.
Continuous text and heading fields then show a Translate button in the editor when the field is clicked. This is also offered in the navigation editing for the text of the navigation point as well as in the mask of the text modules.
The following example is based on an Italian language project that was created on the basis of the German standard language project (e.g. /de -> /it). The copy of the pages in the Italian project therefore still has the German texts that need to be translated.
By clicking on this button, the current text and the language of the current project are transferred to the DeepL interface as the target language. After a short time, the previous text is replaced by the translated text. The language of the source text is automatically recognized by the DeepL API.
Click on this button to undo the translation process.
You can use the "onAfterSaveFile" project event to ensure that the corresponding pages are translated directly when saving a page in the standard language project. There is already a predefined macro for this event, which can be adapted to individual requirements. The PHP framework functions used are documented below via the links.
Using content references (see tip below), the content can also be set even more precisely with regard to the areas to be translated.
It is best to use the additional module "Advanced language management" with the DeepL interface in order to be able to manage the corresponding languages and language links more conveniently and better than without the module.
The basis for what is translated within the XML structure of the pages is stored in a content reference file, which is stored in the software:
/weblication/grid5/default/project/wGlobal/content/contentReferences/default.wContentReferences.php
The XML nodes that are to be used for a deepL translation are specified here via xPath information.
If further areas are to be considered in the project, store this default.wContentReferences.php file as follows:
[wGlobalProject|wSuperglobalProject]/wGlobal/content/contentReferences/default.wContentReferences.php
(the specification [wGlobalProject|wSuperglobalProject] stands for the path of the global or superglobal project (e.g. /default-wGlobal or /multi-wGlobal)
Examples:
If you are of the opinion that the individual fields you have specified are ones that should also be translated in the standard, please let us know via the support button so that we can check whether they should be adopted in the standard.