Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ai
Merge requests
!379
Keep published status.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Keep published status.
issue/ai-3494285:3494285-translating-unpublished-content
into
1.0.x
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Valery Lourie
requested to merge
issue/ai-3494285:3494285-translating-unpublished-content
into
1.0.x
3 months ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Closes
#3494285
0
0
Merge request reports
Compare
1.0.x
1.0.x (base)
and
latest version
latest version
e9c40100
1 commit,
3 months ago
1 file
+
6
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
modules/ai_translate/src/Controller/AiTranslateController.php
+
6
−
0
Options
@@ -7,6 +7,7 @@ use Drupal\Core\Config\ImmutableConfig;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\DependencyInjection\DependencySerializationTrait
;
use
Drupal\Core\Entity\ContentEntityInterface
;
use
Drupal\Core\Entity\EntityPublishedInterface
;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\Core\Template\TwigEnvironment
;
use
Drupal\Core\Url
;
@@ -289,6 +290,11 @@ class AiTranslateController extends ControllerBase {
array
&
$context
,
)
{
$translation
=
$entity
->
addTranslation
(
$lang_to
);
// Keep published status when translating.
if
(
$entity
instanceof
EntityPublishedInterface
)
{
$entity
->
isPublished
()
?
$translation
->
setPublished
()
:
$translation
->
setUnpublished
();
}
$this
->
textExtractor
->
insertTextMetadata
(
$translation
,
$context
[
'results'
][
'processedTranslations'
]);
try
{
Loading