Skip to content

[FEATURE] Introduce API v3 support for glossaries#493

Open
calien666 wants to merge 6 commits intomainfrom
feature/introduce-glossary-api-v3
Open

[FEATURE] Introduce API v3 support for glossaries#493
calien666 wants to merge 6 commits intomainfrom
feature/introduce-glossary-api-v3

Conversation

@calien666
Copy link
Copy Markdown
Member

@calien666 calien666 commented Sep 21, 2025

In preparation of the glossary usage of DeepL API v3 some structural changes
needed to be applied, before the main work could be done in deepltranslate_glossary.

This pull request prepares the changes.

Split one client into dedicated interfaces

Instead of using only one client wrapper for communicating with the
DeepL API, a basic abstract client is now made, which is the basic for
all other implementations across DeepL.

New introduced interfaces:

WebVision\Deepltranslate\Core\Client\DeepLClientInterface

Mirrors the official DeepL PHP API [1]. This helps to identify changes
inside the DeepL API, which will be made by the DeepL team even on minor
level, not correctly following semver.

WebVision\Deepltranslate\Core\ClientInterface

The main interface for all usages against the DeepL API and extendable
through other interfaces allowing use case specific implementations.

WebVision\Deepltranslate\Core\UsageInterface

Extends the ClientInterface and provides methods for fetching usage
statistics from the DeepL API

WebVision\Deepltranslate\Core\TranslatorInterface

Extends the ClientInterface with a method skeleton needed for DeepL
translations.

WebVision\Deepltranslate\Core\GlossaryV2Interface

Provides method skeletons for the old DeepL API v2 glossary
implementation. THis interface is deprecated and will be removed as soon
as DeepL drops API v2 support.

WebVision\Deepltranslate\Core\GlossaryV3Interface

Interface for the new DeepL API v3 multilingual glossary, which now is
persisted.

DeepLClient

This client is now autowired and autoconfigured by PHP Attributes and
gets configuration from the ConfigurationInterface injected. This makes
the class auto loadable without further configuration.
It implements the DeepLClientInterface and extends the official
DeepLClient.

Other changes

In favour of the new configuration API inside DeepL Translate core the
former php-mock for the Client for test usages is no longer needed.

Therefore, the AbstractDeepLTestCase is adopted to fit the new
structure, and the mock together with the mock instantiation is removed.

In this step, the test_services_override extension is no longer needed
and therefore removed.

Tests were streamlined, using a global configuration in all cases to
improve stability and maintainability.

In preparation to more flexibility against the DeepL API, a config file
ext_conf_template.txt was added to allow more configuration. This is
currently working, but not finished yet and needs more testing and
documentation, before the feature is officially announced. Currently,
this is internal only and code could change without further notice.

@calien666 calien666 force-pushed the feature/introduce-glossary-api-v3 branch from 54a8467 to 607d487 Compare February 6, 2026 09:22
@calien666 calien666 force-pushed the feature/introduce-glossary-api-v3 branch from 607d487 to 78422ea Compare February 20, 2026 11:12
@calien666 calien666 force-pushed the feature/introduce-glossary-api-v3 branch 6 times, most recently from 3f0d558 to ca183ca Compare March 20, 2026 18:32
@calien666 calien666 force-pushed the feature/introduce-glossary-api-v3 branch 2 times, most recently from 81eacb2 to 6b61889 Compare March 20, 2026 19:15
@calien666 calien666 force-pushed the feature/introduce-glossary-api-v3 branch from 6b61889 to 0fffc14 Compare April 17, 2026 07:34
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Documentation rendering

You can find files attached to the below linked Workflow Run URL (Logs).

Please note that files only stay for around 5 days!

Name Link
Commit f1c7084
Logs https://github.com/web-vision/deepltranslate-core/actions/runs/24752119735
Documentation https://github.com/web-vision/deepltranslate-core/actions/runs/24752119735/artifacts/6567509210

@calien666 calien666 force-pushed the feature/introduce-glossary-api-v3 branch 5 times, most recently from f25e846 to af1199f Compare April 17, 2026 11:52
@calien666 calien666 marked this pull request as ready for review April 17, 2026 13:27
@calien666 calien666 requested a review from sbuerk April 17, 2026 13:29
@sbuerk sbuerk force-pushed the feature/introduce-glossary-api-v3 branch 2 times, most recently from dad916c to 410b077 Compare April 21, 2026 19:49
In preparation of switching DeepL TYPO3 extensions to API v3 support,
it is necessary replacing the old `Translator` to the new `DeepLClient`,
which holds the new features introduced.
The new API v3 changes the behaviour in glossary handling completely.
However, the support for v2 is not dropped for the moment, but will be.
As it is more simple to maintain only one functionality for glossaries,
deprecate the old methods.
Add the new muli lingual glossary methods to the `ClientInterface`
and set the old ones deprecated. The deprecation is done because
supporting API v2 and v3 does not make sense and should be skipped
soon. Only kept until addon implementation has been aligned to this.
Due to ongoing issues and not working with semver by deepl-php API,
we need a possibility to harden our implementation against the DeepL PHP
API. This is done by the new introduced `DeepLClientInterface.php`
mirroring the official `DeepLClient`.
This helps to detect changes inside the DeepL PHP API and update the
extension itself, if needed.

Besides, the complete registration of the `DeepLClient` is made
auto-configurable to ensure DI for the DeepLClient connection.

The positive side effect on this change is the drop of the
`test_extensions_override` and the `PHPMock` from the functional tests,
as the DI load now is given even for the test instances and against the
mock server.

To achieve the goal of a full Dependency injection, the `Configuration`
has to be changed, too, to allow the override for headers and the server
URL.

With this change, the PHP mock and the `test_services_override` could
be easily dropped, as the Client is now automatically set up.

Due to the changes for the injection of the DeepL client, the internal
unit test ClientTest.php was removed completely, as the only goal was to
check the exceptions being thrown correctly. With the Dependency
Injection of the DeepLClient, this is no longer necessary.

Side-change: Removed `helmich/php-json-assert`, as the trait was
implemented, but unused.

Used commands:

```shell
Build/Scripts/runTests.sh -s composer remove --dev \
    helmich/phpunit-json-assert \
    php-mock/php-mock-phpunit
```
For a better overview and encapsulation of functions according to the
DeepL API, the internal `Client`, used as wrapper to the official API,
is split into dedicated functional parts.

The respective Interfaces for `Usage` and `Translator` were introduced
times ago, and now this will take effect by defining clients for their
use cases.

The Services needing the CLient were adopted to the new interfaces to
keep functionality `as-is`.

As the `Client` was set to final and therefore was not extendable, this
change should have no unwanted side effect to other extensions building
up on `deepltranslate_core`.

This was needed to split out the Glossary functionality completely from
the `deepltranslate_core` and only define the Interfaces for Glossary
API v2 and v3.

The functionality of glossary management is moved into
`deepltranslate_glossary` as it's unused inside `deepltracnslate_core`
and a dedicated functionality should be handled inside the respective
extension.
@sbuerk sbuerk force-pushed the feature/introduce-glossary-api-v3 branch 2 times, most recently from fd2aa7d to fc08736 Compare April 21, 2026 23:07
sbuerk pushed a commit to web-vision/deepltranslate-glossary that referenced this pull request Apr 21, 2026
`EXT:deepltranslate_core` refactors the DeepL client structure
shared across all `WebVision DeepL Ecosystem` extensions [1].
This prepares future support for `Glossary API v3`, including
multilingual glossaries, bidirectional synchronization, and
import/export capabilities.

Enhanced glossary support is a highly requested feature and
will be delivered in a follow-up change. For now, this patch
restores the `Glossary API v2` implementation to ensure a
working baseline compatible with TYPO3 v13 and v14.

Next-generation glossary integration will be introduced as a
separate feature in a minor release of `deepltranslate_glossary`.

[1] web-vision/deepltranslate-core#493
@sbuerk sbuerk force-pushed the feature/introduce-glossary-api-v3 branch from fc08736 to 7bb064a Compare April 21, 2026 23:34
This change does a tabula rasa throughout the prefvious
change and `EXT:deepltranslate_core` in general having
streamlining of dependency injection attribute usages
and definition in mind.
@sbuerk sbuerk force-pushed the feature/introduce-glossary-api-v3 branch from 7bb064a to f1c7084 Compare April 21, 2026 23:38
sbuerk pushed a commit to web-vision/deepltranslate-glossary that referenced this pull request Apr 22, 2026
`EXT:deepltranslate_core` refactors the DeepL client structure
shared across all `WebVision DeepL Ecosystem` extensions [1].
This prepares future support for `Glossary API v3`, including
multilingual glossaries, bidirectional synchronization, and
import/export capabilities.

Enhanced glossary support is a highly requested feature and
will be delivered in a follow-up change. For now, this patch
restores the `Glossary API v2` implementation to ensure a
working baseline compatible with TYPO3 v13 and v14.

Next-generation glossary integration will be introduced as a
separate feature in a minor release of `deepltranslate_glossary`.

[1] web-vision/deepltranslate-core#493
sbuerk pushed a commit to web-vision/deepltranslate-glossary that referenced this pull request Apr 23, 2026
`EXT:deepltranslate_core` refactors the DeepL client structure
shared across all `WebVision DeepL Ecosystem` extensions [1].
This prepares future support for `Glossary API v3`, including
multilingual glossaries, bidirectional synchronization, and
import/export capabilities.

Enhanced glossary support is a highly requested feature and
will be delivered in a follow-up change. For now, this patch
restores the `Glossary API v2` implementation to ensure a
working baseline compatible with TYPO3 v13 and v14.

This is based on the refactoring inn `EXT:deeptranslate_core`
and the dedicated, splitted client implementation, and opens
the ability to deal with the Glossary API versions directly
within `EXT:deepltranslate_glossary` regarding interfaces and
client implementation. That reduces roundtrips in the future
between these two extensions. [1]

Next-generation glossary integration will be introduced as a
separate feature in a minor release of `deepltranslate_glossary`.

[1] web-vision/deepltranslate-core#493
sbuerk pushed a commit to web-vision/deepltranslate-glossary that referenced this pull request Apr 23, 2026
`EXT:deepltranslate_core` refactors the DeepL client structure
shared across all `WebVision DeepL Ecosystem` extensions [1].
This prepares future support for `Glossary API v3`, including
multilingual glossaries, bidirectional synchronization, and
import/export capabilities.

Enhanced glossary support is a highly requested feature and
will be delivered in a follow-up change. For now, this patch
restores the `Glossary API v2` implementation to ensure a
working baseline compatible with TYPO3 v13 and v14.

This is based on the refactoring inn `EXT:deeptranslate_core`
and the dedicated, splitted client implementation, and opens
the ability to deal with the Glossary API versions directly
within `EXT:deepltranslate_glossary` regarding interfaces and
client implementation. That reduces roundtrips in the future
between these two extensions. [1]

Next-generation glossary integration will be introduced as a
separate feature in a minor release of `deepltranslate_glossary`.

[1] web-vision/deepltranslate-core#493
sbuerk pushed a commit to web-vision/deepltranslate-glossary that referenced this pull request Apr 23, 2026
`EXT:deepltranslate_core` refactors the DeepL client structure
shared across all `WebVision DeepL Ecosystem` extensions [1].
This prepares future support for `Glossary API v3`, including
multilingual glossaries, bidirectional synchronization, and
import/export capabilities.

Enhanced glossary support is a highly requested feature and
will be delivered in a follow-up change. For now, this patch
restores the `Glossary API v2` implementation to ensure a
working baseline compatible with TYPO3 v13 and v14.

This is based on the refactoring inn `EXT:deeptranslate_core`
and the dedicated, splitted client implementation, and opens
the ability to deal with the Glossary API versions directly
within `EXT:deepltranslate_glossary` regarding interfaces and
client implementation. That reduces roundtrips in the future
between these two extensions. [1]

Next-generation glossary integration will be introduced as a
separate feature in a minor release of `deepltranslate_glossary`.

[1] web-vision/deepltranslate-core#493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants