Skip to content

Commit

Permalink
Merge pull request neos#3697 from pKallert/task-translate-backend-mes…
Browse files Browse the repository at this point in the history
…sages

TASK: Translate backend messages
  • Loading branch information
pKallert authored Jun 25, 2024
2 parents ee00f76 + 3266b31 commit 56ec023
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 7 additions & 5 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ public function changeAction(array $changes): void
$changes->apply();

$success = new Info();
$success->setMessage(sprintf('%d change(s) successfully applied.', $count));
$success->setMessage(
$this->getLabel('changesApplied', [$count], $count)
);

$this->feedbackCollection->add($success);
} catch (\Exception $e) {
Expand Down Expand Up @@ -441,9 +443,7 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d
} catch (WorkspaceIsNotEmptyException $exception) {
$error = new Error();
$error->setMessage(
'Your personal workspace currently contains unpublished changes.'
. ' In order to switch to a different target workspace you need to either publish'
. ' or discard pending changes first.'
$this->getLabel('workspaceContainsUnpublishedChanges')
);

$this->feedbackCollection->add($error);
Expand All @@ -467,7 +467,9 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d
$documentNode = $subgraph->findNodeById($command->documentNode->nodeAggregateId);

$success = new Success();
$success->setMessage(sprintf('Switched base workspace to %s.', $targetWorkspaceName));
$success->setMessage(
$this->getLabel('switchedBaseWorkspace', ['workspace' => $targetWorkspaceName])
);
$this->feedbackCollection->add($success);

$updateWorkspaceInfo = new UpdateWorkspaceInfo($contentRepositoryId, $userWorkspaceName);
Expand Down
4 changes: 2 additions & 2 deletions Classes/Controller/TranslationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ trait TranslationTrait
/**
* @param array<int|string,mixed> $arguments
*/
public function getLabel(string $id, array $arguments = []): string
public function getLabel(string $id, array $arguments = [], ?int $quantity = null): string
{
return $this->translator->translateById(
$id,
$arguments,
null,
$quantity,
null,
'Main',
'Neos.Neos.Ui'
Expand Down
8 changes: 8 additions & 0 deletions Resources/Private/Translations/en/Main.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@
<source>Discarded {0} changes.</source>
</trans-unit>
</group>
<trans-unit id="switchedBaseWorkspace" xml:space="preserve">
<source>Switched base workspace to "{workspace}".</source>
</trans-unit>
<trans-unit id="workspaceContainsUnpublishedChanges" xml:space="preserve">
<source>Your personal workspace currently contains unpublished changes.
In order to switch to a different target workspace you need to either publish or discard pending changes first.
</source>
</trans-unit>
<trans-unit id="syncUriPathSegment" xml:space="preserve">
<source>Syncronize with the title property</source>
</trans-unit>
Expand Down

0 comments on commit 56ec023

Please sign in to comment.