Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Translate backend messages #3697

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,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 @@ -431,9 +433,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 @@ -457,7 +457,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>
pKallert marked this conversation as resolved.
Show resolved Hide resolved
</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
Loading