werkraum/deepl-translate-slim

Translate all your pages on demand, without additional configuration. You do not need to set up more than one language in TYPO3. Enable Translation targets in your site configuration and display a language menu with our Menu Integration and you are ready to go.

1.0.4 2024-08-05 12:32 UTC

This package is auto-updated.

Last update: 2024-09-05 12:46:34 UTC


README

Translate all your pages on demand, without additional configuration. You do not need to set up more than one language in TYPO3. Enable Translation targets in your site configuration and display a language menu with our Menu Integration and you are ready to go.

  • Pages are only translated on demand
    • a middleware processes the response from TYPO3 and has it translated by DeepL
    • the translation process can be customized to your needs Custom Translation Processing
  • all translation targets are validated
    • e.g. if you disabled DK it is not possible to bypass this value
  • search bots are excluded by default (otherwise they could use up you api translation volume)
  • all fetched translations are stored in a separate cache (to further protect you api volume)

Further Infos

Demo Link (german)

first News (german)

https://werkraum.net/typo3-deepl-integration (german)

Installation

composer require werkraum/deepl-translate-slim

Extension Setup

You have to provide an authenticationKey. Make sure to set the API Type to pro if you have a pro account.

deepl_extension_settings.png

Global Configuration Values

Site Configuration Values

Menu Integration

The extension has a custom \Werkraum\DeeplTranslate\DataProcessing\DeepLMenuProcessor to provide the enabled DeepL translation targets. It provides the same values as the \TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor

dataProcessing {
  10 = Werkraum\DeeplTranslate\DataProcessing\DeepLMenuProcessor
  10 {
    as = menu
  }
}
<html data-namespace-typo3-fluid="true"
      xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
>
<nav class="nav languagenav text-uppercase notranslate">
    <f:for each="{menu}" as="item" iteration="iter">
        <a class="nav-link" href="{item.link}" hreflang="{item.hreflang}" title="{item.title}">
            <span>{item.title}</span>
        </a>
    </f:for>
</nav>
</html>

Caching

The extension has its own cache to ensure that translations are retained in the system even if the content of the pages changes. The service is not free of charge and should be used sparingly. Nevertheless, this cache can be checked and emptied:

deepl_menu_clear_cache.png

You can enable cacheClear in the extension configuration to always flush the translations on page or page content change. By default it is disabled.

A dedicated view in the InfoModule provides a detailed overview of all cached pages.

deepl_info_module_cache_overview.png

Custom Translation Processing

You can customize and extend the translation process by implementing a custom DocumentProcessor with the Interface \Werkraum\DeeplTranslate\DocumentProcessor\DocumentProcessorInterface.

Look into ReplaceLinksProcessor.php to see it in action.