PHPackages                             hyperdigital/hd\_translator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. hyperdigital/hd\_translator

ActiveTypo3-cms-extension[Localization &amp; i18n](/categories/localization)

hyperdigital/hd\_translator
===========================

Translation of static strings from locallang.xlf files and export/import of database related content

2.1.4(7mo ago)69.6k↓35.3%4[6 issues](https://github.com/hyperdigital/hd_translator/issues)[1 PRs](https://github.com/hyperdigital/hd_translator/pulls)GPL-2.0-or-laterPHP

Since Dec 21Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/hyperdigital/hd_translator)[ Packagist](https://packagist.org/packages/hyperdigital/hd_translator)[ RSS](/packages/hyperdigital-hd-translator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (53)Used By (0)

Translator
==========

[](#translator)

TYPO3 extension for handling translations. It allows editors to edit static strings from XLF files (usually placed in *EXT:/Resources/Private/Languages*) or to export database entries, edit them over translation tool/agency in the xlf format and then import it again back to TYPO3.

Changelog
---------

[](#changelog)

- [Release 2.0.5](Documentation/Changelog/2.0.5.md)
- [Release 2.0.2](Documentation/Changelog/2.0.2.md)
- [Release 2.0.0](Documentation/Changelog/2.0.0.md)

Initialization
--------------

[](#initialization)

Upon installation, a new submodule will be added under the WEB module. Before utilizing the extension's features, it is essential to specify the location where new translations should be stored. Follow these steps:

1. Navigate to the Extension Configuration section.
2. Look for the "Storage path (from the root of the project)" option within the HD Translator settings. When inserting a relative path in this field, consider that starting point is the project root, where your project's `composer.json` is stored.

Static Strings Translations
---------------------------

[](#static-strings-translations)

### Previews

[](#previews)

#### All locallang files categories

[](#all-locallang-files-categories)

[![All locallang filed](Documentation/Images/all_locallang_files.PNG "All locallang filed")](Documentation/Images/all_locallang_files.PNG)

#### All locallangs for category

[](#all-locallangs-for-category)

[![All locallang for specific category](Documentation/Images/category.PNG "All locallang for specific category")](Documentation/Images/category.PNG)

#### Example of german translation for one locallang

[](#example-of-german-translation-for-one-locallang)

[![Example of german translation](Documentation/Images/detail.PNG "Example of german translation")](Documentation/Images/detail.PNG)

### Specific locallang files

[](#specific-locallang-files)

A key feature of this extension lies in its ability to work seamlessly with `locallang.xlf` files. To enable the handling of specific `locallang.xlf` files, follow these steps:

1. Open the `ext_localconf.php` file in your TYPO3 extension.
2. Add the following configuration to register the desired `locallang.xlf` file (the unique\_key must be always unique):

    ```
    $GLOBALS['TYPO3_CONF_VARS']['translator']['unique_key'] = [
        'label' => 'My Cool Extension - Base',
        'path' => 'EXT:cool_extension/Resources/Private/Language/locallang.xlf',
        'category' => 'Cool Extension',
        'languages' => [
            'en',
            'de',
            'cs'
        ]
    ];
    ```

    - `label`: Provide a descriptive label for the set of translations.
    - `path`: Specify the path to the target `locallang.xlf` file within your extension.
    - `category`: Categorize the translations under a specific category.
    - `languages`: Define the supported languages for the translations.

Ensure that the provided path is correct and corresponds to the actual location of your `locallang.xlf` file. You can extend the 'languages' array to include additional language codes as required.

### Synchronizing All locallang.xlf Files

[](#synchronizing-all-locallangxlf-files)

The system has the capability to retrieve all accessible `locallang.xlf` files across all extensions, making translation management more efficient. Follow these steps to synchronize the files:

1. In the extension configuration, locate and check the checkbox labeled "All locallang.xlf files."
2. Navigate to the Translator module within the TYPO3 backend.
3. Find the "Synchronize all files" button and click on it.

This action generates settings for all the `locallang.xlf` files, ensuring that the system is aware of and can handle translations from every extension. If you add a new translation file or introduce a new extension, it's essential to click the "Synchronize all files" button again. This process updates the system settings accordingly.

By utilizing this feature, you streamline the management of translations across your TYPO3 project, ensuring that the Translator module is aware of all relevant translation files and extensions.

### Correct Language Configuration

[](#correct-language-configuration)

To define the correct language for your TYPO3 site, you can specify it within the site configuration file located at `config/sites/xxx/config.yaml`. Here's an example configuration:

```
languages:
  -
    ...
    typo3Language: de
    ...
```

### Enable New Language not Supported by TYPO3

[](#enable-new-language-not-supported-by-typo3)

To enable a new language not supported by TYPO3, add the following code to either `LocalConfiguration.php` or `AdditionalConfiguration.php`. Ensure that this code appears before all extensions are loaded:

```
$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user']['us'] = 'English US';
```

Important Components:

- 'us': This serves as the language key used in translation files.
- 'English US': Represents the name of the language.

### Translation Removal and Backup

[](#translation-removal-and-backup)

When you remove a translation, the system automatically creates a backup of the deleted translation. If you attempt to create the same translation again, you will be prompted with an option to either restore the backup or generate a new translation from scratch.

Database Export
---------------

[](#database-export)

The extension provides a flexible mechanism for exporting fields from the database, allowing you to tailor the exported data based on your needs.

### Default Export Settings

[](#default-export-settings)

The default list of exported fields from the database is located in the same section as the "Show Fields" configuration. It follows the same "type" logic. If this setting is empty, all accessible non-TYPO3 core fields will be included in the export.

```
$GLOBALS['TCA'][$table]['types'][1]['translator_export'] = 'title, subtitle, another_field';
```

#### Different Settings for Different Table Types

[](#different-settings-for-different-table-types)

In many cases, you may find it necessary to have distinct settings for various content elements. For instance, you might want specific export configurations for a Content Element of type 'Header' as opposed to a 'Text' element. To achieve this level of granularity, utilize the type-specific settings. Here's an example for 'Header' and 'Text' elements within the `tt_content` table:

##### Header Content Element

[](#header-content-element)

```
$GLOBALS['TCA']['tt_content']['types']['header']['translator_export'] = 'header, subheader';
```

##### Text Content Element

[](#text-content-element)

```
$GLOBALS['TCA']['tt_content']['types']['text']['translator_export'] = 'header, subheader, bodytext';
```

#### Exporting Flexform Fields

[](#exporting-flexform-fields)

When the Flexform is included in the export, it retrieves all fields by default. However, you can limit the exported fields similar to the entire table. Use the following configuration:

```
$GLOBALS['TCA'][$table]['types'][1]['translator_export_column']['pi_flexform'] = 'settings.text, settings.header';
```

#### Custom Notes for fields

[](#custom-notes-for-fields)

If the fields requires some special note, it's possible to add into notes by different options:

##### Pure TCA config

[](#pure-tca-config)

```
$GLOBALS['TCA']['tt_content']['columns']['header']['config']['translator_note'] = 'Here is a note for translators';
```

##### Flexfrom config

[](#flexfrom-config)

```
$GLOBALS['TCA'][$table]['types'][1]['translator_export_column_notes']['pi_flexform']['settings.text'] = 'Here is a note for translators';
```

### Displaying Export Buttons

[](#displaying-export-buttons)

Export buttons will appear next to the save or edit buttons when editing a table entry or within the Page module. It's also a part of context menues.

Customize the export settings according to your specific requirements to ensure that only the necessary data is included in the exported file.

Database Import
---------------

[](#database-import)

### Disable fields from possible update

[](#disable-fields-from-possible-update)

This feature is useful when you want to avoid overwriting existing page slugs. During the import of database entries, the data is inserted into the database as usual. However, if you attempt to re-import the same table, the specified fields in the list will be skipped to prevent unintended changes.

```
$GLOBALS['TCA']['pages']['types'][1]['translator_import_ignore'] = 'slug,url';
```

DeepL AI Translation
--------------------

[](#deepl-ai-translation)

This extension enables AI-powered translations using DeepL **in the frontend only**. To get started, complete the setup steps below:

1. **Add your DeepL API key**
    Go to your DeepL account → [API Keys](https://www.deepl.com/de/your-account/keys) and copy your key into the extension’s configuration.
2. **Enable AI Translations**
    In the TYPO3 backend, open the **Translator** module and switch the header tab to **AI Translations**.
3. **Synchronize languages**
    Click **Synchronize available languages**. This will fetch all supported languages and make them available for translation.

Once that’s done, you’ll see a list of languages along with any existing translations.

---

### Using Translations in the Frontend

[](#using-translations-in-the-frontend)

Under the hood:

- Your page content is parsed by JavaScript into individual strings.
- Each string is sent to a data processor.
- The processor checks if a translation already exists in the database:
    - **If yes**, it returns the cached translation.
    - **If no**, it queries DeepL and stores the result for future use.

This caching strategy prevents you from hitting DeepL’s API limits too quickly.

To enable on-the-fly translation, include the provided TypoScript static file in your site template. Then you can call these JS functions:

```
// Translate the entire page into German (code “de”)
hdtranslator_translateWholePage('de');
// → Asynchronously scans the DOM in segments and replaces text in order.

// Translate a single string
hdtranslator_translateText('Translate me this content', 'de');
  .then(translation => console.log(translation))
  .catch(err => console.error('Failed to load translation:', err));

// Fetch supported DeepL languages
hdtranslator_fetchSupportedLanguages()
  .then(languages => console.log(languages))
  .catch(err => console.error('Failed to load languages:', err));
```

For the function `hdtranslator_translateWholePage` you can ommit specific strings by:

- class="notranslate"
- data-notranslate
- translate="no"

### PHP API Usage

[](#php-api-usage)

You can also call DeepL directly in PHP via the `DeeplApiService`:

```
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Hyperdigital\HdTranslator\Services\DeeplApiService;

// 1) Get all available languages
/** @var DeeplApiService $deeplApi */
$deeplApi = GeneralUtility::makeInstance(DeeplApiService::class);
$languages = $deeplApi->getAvailableLanguages(true);

// 2) Translate one or more texts
$texts = ['Translate me this content'];
$translations = $deeplApi->translateTexts($texts, 'de');
```

### Editing Existing Translations

[](#editing-existing-translations)

1. In the Translator module, open the AI Translations tab.
2. Select the target language from the dropdown.
3. Locate the string you want to update: a) Click the translated text to open a TYPO3 editing form. b) Or click the original (source) text to view all translations across every language.
4. Edit and save—your changes will appear on the frontend immediately.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance49

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Total

49

Last Release

211d ago

Major Versions

1.1.9 → 2.0.82025-07-09

1.2.0 → 2.1.02025-08-06

1.2.1 → 2.1.12025-09-02

2.1.3 → v12.x-dev2025-10-20

1.2.2 → 2.1.42025-10-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/570275984d4469e32ae0e63756acd240237e53a7275faecb1baa6b28e414aa6e?d=identicon)[hyperdigital](/maintainers/hyperdigital)

![](https://www.gravatar.com/avatar/1efd154aaea13b09575d581f8828321fa2969da7b08f3809095119c42e1048c3?d=identicon)[ununik](/maintainers/ununik)

---

Top Contributors

[![martinpribylhd](https://avatars.githubusercontent.com/u/153900403?v=4)](https://github.com/martinpribylhd "martinpribylhd (118 commits)")[![thomasrawiel](https://avatars.githubusercontent.com/u/5371428?v=4)](https://github.com/thomasrawiel "thomasrawiel (11 commits)")[![LimeUwe](https://avatars.githubusercontent.com/u/8911618?v=4)](https://github.com/LimeUwe "LimeUwe (5 commits)")[![dni990](https://avatars.githubusercontent.com/u/70429008?v=4)](https://github.com/dni990 "dni990 (4 commits)")[![eliashaeussler](https://avatars.githubusercontent.com/u/16313625?v=4)](https://github.com/eliashaeussler "eliashaeussler (1 commits)")

### Embed Badge

![Health badge](/badges/hyperdigital-hd-translator/health.svg)

```
[![Health](https://phpackages.com/badges/hyperdigital-hd-translator/health.svg)](https://phpackages.com/packages/hyperdigital-hd-translator)
```

###  Alternatives

[leuchtfeuer/locate

Locate - The users country, preferred language and other facts will be detected. Depending on configurable rules the user can be redirected to other languages or pages. Locate also provides geo blocking for configurable pages in configurable countries.

1182.8k](/packages/leuchtfeuer-locate)[evoweb/ew-llxml2xliff

Convert locallang.xml/.php files to .xlf

1045.7k1](/packages/evoweb-ew-llxml2xliff)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
