Skip to content

Remove Automated translations from 6.0 - #3369

Merged
dabrt merged 4 commits into
6.0from
remove_at
Aug 27, 2026
Merged

Remove Automated translations from 6.0#3369
dabrt merged 4 commits into
6.0from
remove_at

Conversation

@dabrt

@dabrt dabrt commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
Question Answer
JIRA Ticket N/A
Versions 6.0 and up
Edition all

Remove Automated translations from 6.0. Cherry pick carefully to 5.0

Checklist

  • Text renders correctly
  • Text has been checked with vale

@github-actions

Copy link
Copy Markdown

Comment thread tools/api_refs/.phpdoc/template/package-edition-map.twig
Comment thread docs/multisite/translations_management/translations_management_guide.md Outdated
Comment thread docs/release_notes/cohesivo_v6.0_deprecations.md Outdated
@mnocon

mnocon commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Please also have a look at the failing CI:

Error: Class App\AutomatedTranslation\AiClient implements unknown interface Ibexa\Contracts\AutomatedTranslation\Client\ClientInterface.
Error: Method App\AutomatedTranslation\AiClient::setConfiguration() has parameter $configuration with no value type specified in iterable type array.
Error: Instantiated class Ibexa\Contracts\AutomatedTranslation\Exception\ClientNotConfiguredException not found.
Error: Throwing object of an unknown class Ibexa\Contracts\AutomatedTranslation\Exception\ClientNotConfiguredException.
Error: Class App\AutomatedTranslation\ImageFieldEncoder implements unknown interface Ibexa\Contracts\AutomatedTranslation\Encoder\Field\FieldEncoderInterface.

There are some code samples we can remove and no longer maintain

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 750731
🔗 Unique 15049
✅ Successful 6302
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 744429
❓ Unknown 0
🚫 Errors 0
⛔ Unsupported 0

Full Github Actions output

@dabrt
dabrt requested a review from mnocon August 27, 2026 09:44
@mnocon

mnocon commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Please run composer baseline to regenerate the Deptrac baseline: it's failing on CI:

Error: Skipped violation "Ibexa\Core\FieldType\Image\Value" for "App\AutomatedTranslation\ImageFieldEncoder" was not matched.

Looks good otherwise!

@github-actions

Copy link
Copy Markdown

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/multisite/automated_translation/config/services.yaml


code_samples/multisite/automated_translation/config/services.yaml

docs/multisite/languages/automated_translations.md@109:``` yaml
docs/multisite/languages/automated_translations.md@110:[[= include_file('code_samples/multisite/automated_translation/config/services.yaml', 15, 18) =]]
docs/multisite/languages/automated_translations.md@111:```

001⫶ App\AutomatedTranslation\AiClient:
002⫶ tags:
003⫶ - ibexa.automated_translation.client

docs/multisite/languages/automated_translations.md@115:``` yaml
docs/multisite/languages/automated_translations.md@116:[[= include_file('code_samples/multisite/automated_translation/config/services.yaml', 23, 32) =]]
docs/multisite/languages/automated_translations.md@117:```

001⫶ibexa_automated_translation:
002⫶ system:
003⫶ default:
004⫶ configurations:
005⫶ aiclient:
006⫶ languages:
007⫶ - 'en_GB'
008⫶ - 'fr_FR'

docs/multisite/languages/automated_translations.md@147:``` yaml
docs/multisite/languages/automated_translations.md@148:[[= include_file('code_samples/multisite/automated_translation/config/services.yaml', 19, 22) =]]
docs/multisite/languages/automated_translations.md@149:```

001⫶ App\AutomatedTranslation\ImageFieldEncoder:
002⫶ tags:
003⫶ - ibexa.automated_translation.field_encoder


code_samples/multisite/automated_translation/src/AutomatedTranslation/AiClient.php


code_samples/multisite/automated_translation/src/AutomatedTranslation/AiClient.php

docs/multisite/languages/automated_translations.md@103:``` php hl_lines="31-48"
docs/multisite/languages/automated_translations.md@104:[[= include_code('code_samples/multisite/automated_translation/src/AutomatedTranslation/AiClient.php') =]]
docs/multisite/languages/automated_translations.md@105:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\AutomatedTranslation;
004⫶
005⫶use Ibexa\Contracts\AutomatedTranslation\Client\ClientInterface;
006⫶use Ibexa\Contracts\AutomatedTranslation\Exception\ClientNotConfiguredException;
007⫶use Ibexa\Contracts\ConnectorAi\Action\DataType\Text;
008⫶use Ibexa\Contracts\ConnectorAi\Action\RuntimeContext;
009⫶use Ibexa\Contracts\ConnectorAi\ActionConfigurationServiceInterface;
010⫶use Ibexa\Contracts\ConnectorAi\ActionServiceInterface;
011⫶
012⫶final class AiClient implements ClientInterface
013⫶{
014⫶ /** @var array<string> */
015⫶ private array $supportedLanguages;
016⫶
017⫶ public function __construct(
018⫶ private readonly ActionServiceInterface $actionService,
019⫶ private readonly ActionConfigurationServiceInterface $actionConfigurationService
020⫶ ) {
021⫶ }
022⫶
023⫶ public function setConfiguration(array $configuration): void
024⫶ {
025⫶ if (!array_key_exists('languages', $configuration)) {
026⫶ throw new ClientNotConfiguredException('List of supported languages is missing in the configuration under the "languages" key');
027⫶ }
028⫶ $this->supportedLanguages = $configuration['languages'];
029⫶ }
030⫶
031❇️ public function translate(string $payload, ?string $from, string $to): string
032❇️ {
033❇️ $action = new TranslateAction(new Text([$payload]));
034❇️ $action->setRuntimeContext(
035❇️ new RuntimeContext(
036❇️ [
037❇️ 'from' => $from,
038❇️ 'to' => $to,
039❇️ ]
040❇️ )
041❇️ );
042❇️ $actionConfiguration = $this->actionConfigurationService->getActionConfiguration('translate');
043❇️ $actionResponse = $this->actionService->execute($action, $actionConfiguration)->getOutput();
044❇️
045❇️ assert($actionResponse instanceof Text);
046❇️
047❇️ return $actionResponse->getText();
048❇️ }
049⫶
050⫶ public function supportsLanguage(string $languageCode): bool
051⫶ {
052⫶ return in_array($languageCode, $this->supportedLanguages, true);
053⫶ }
054⫶
055⫶ public function getServiceAlias(): string
056⫶ {
057⫶ return 'aiclient';
058⫶ }
059⫶
060⫶ public function getServiceFullName(): string
061⫶ {
062⫶ return 'Custom AI Automated Translation';
063⫶ }
064⫶}


code_samples/multisite/automated_translation/src/AutomatedTranslation/ImageFieldEncoder.php


code_samples/multisite/automated_translation/src/AutomatedTranslation/ImageFieldEncoder.php

docs/multisite/languages/automated_translations.md@133:``` php hl_lines="11-14 16-19 21-27 33-38"
docs/multisite/languages/automated_translations.md@134:[[= include_code('code_samples/multisite/automated_translation/src/AutomatedTranslation/ImageFieldEncoder.php') =]]
docs/multisite/languages/automated_translations.md@135:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\AutomatedTranslation;
004⫶
005⫶use Ibexa\Contracts\AutomatedTranslation\Encoder\Field\FieldEncoderInterface;
006⫶use Ibexa\Contracts\Core\Repository\Values\Content\Field;
007⫶use Ibexa\Core\FieldType\Image\Value;
008⫶
009⫶final class ImageFieldEncoder implements FieldEncoderInterface
010⫶{
011❇️ public function canEncode(Field $field): bool
012❇️ {
013❇️ return $field->fieldTypeIdentifier === 'ibexa_image';
014❇️ }
015⫶
016❇️ public function canDecode(string $type): bool
017❇️ {
018❇️ return $type === 'ibexa_image';
019❇️ }
020⫶
021❇️ public function encode(Field $field): string
022❇️ {
023❇️ /** @var \Ibexa\Core\FieldType\Image\Value $value */
024❇️ $value = $field->getValue();
025❇️
026❇️ return $value->alternativeText ?? '';
027❇️ }
028⫶
029⫶ /**
030⫶ * @param string $value
031⫶ * @param \Ibexa\Core\FieldType\Image\Value $previousFieldValue
032⫶ */
033❇️ public function decode(string $value, $previousFieldValue): Value
034❇️ {
035❇️ $previousFieldValue->alternativeText = $value;
036❇️
037❇️ return $previousFieldValue;
038❇️ }
039⫶}


code_samples/multisite/automated_translation/src/AutomatedTranslation/TranslateAction.php


code_samples/multisite/automated_translation/src/AutomatedTranslation/TranslateAction.php

Download colorized diff

@dabrt

dabrt commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Please run composer baseline to regenerate the Deptrac baseline: it's failing on CI:

Error: Skipped violation "Ibexa\Core\FieldType\Image\Value" for "App\AutomatedTranslation\ImageFieldEncoder" was not matched.

Looks good otherwise!

Fixed!

@mnocon mnocon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dabrt
dabrt merged commit 7d53925 into 6.0 Aug 27, 2026
12 checks passed
@dabrt
dabrt deleted the remove_at branch August 27, 2026 12:40
dabrt added a commit that referenced this pull request Aug 27, 2026
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