From c51a37210290ab8250c7a1b1cae016eac4da6a9b Mon Sep 17 00:00:00 2001 From: Dominik Wille <16685-Harlor@users.noreply.drupalcode.org> Date: Mon, 14 Apr 2025 12:44:53 +0000 Subject: [PATCH] Issue #3519061 by harlor: Cleanup code --- .cspell-project-words.txt | 13 +++++++++++++ README.md | 2 +- src/TsiService.php | 9 --------- src/TsiServiceInterface.php | 22 ---------------------- tests/src/Kernel/TsiApiTest.php | 2 ++ 5 files changed, 16 insertions(+), 32 deletions(-) create mode 100644 .cspell-project-words.txt diff --git a/.cspell-project-words.txt b/.cspell-project-words.txt new file mode 100644 index 0000000..7a65314 --- /dev/null +++ b/.cspell-project-words.txt @@ -0,0 +1,13 @@ +beispiel +beispiele +danke +kartoffel +kartoffeln +katze +katzen +schön +seite +seiten +hund +hunde +mymodule diff --git a/README.md b/README.md index aa7c56e..4b576b7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ In a deploy hook for multiple translation we need to create an array and hand it This is how it looks for singular case: ``` -function mymodule_deploy_singular_mutliple_xy() { +function HOOK_deploy_singular_multiple_xy() { $translations_array = [ 'cat' => 'Katze', 'dog' => 'Hund' diff --git a/src/TsiService.php b/src/TsiService.php index ea589a7..5fa1c64 100644 --- a/src/TsiService.php +++ b/src/TsiService.php @@ -51,15 +51,6 @@ class TsiService implements TsiServiceInterface { $this->clearLocaleCaches($langcode, $lids); } - /** - * Call of the old method. - * - * Redirect the deprecated method to the updated method. - */ - public function addPlural($singular_source, $singular_translated, $plural_source, $plural_translated, $langcode, $context = ''): void { - $this->addPluralTranslation($singular_source, $singular_translated, $plural_source, $plural_translated, $langcode, $context); - } - /** * {@inheritdoc} */ diff --git a/src/TsiServiceInterface.php b/src/TsiServiceInterface.php index d7fcfeb..d5f4875 100644 --- a/src/TsiServiceInterface.php +++ b/src/TsiServiceInterface.php @@ -35,28 +35,6 @@ interface TsiServiceInterface { */ public function addMultipleTranslation(array $translation_array, string $langcode, $context = ''): void; - /** - * Adds translation for plural strings. - * - * @param string $singular_source - * The singular form of the source string in default language. - * @param string $singular_translated - * The singular form of the translated source string in the language given - * by the $langcode. - * @param string $plural_source - * The plural form of the source string in default language. - * @param string $plural_translated - * The plural form of the translated source string in the language given by - * the $langcode. - * @param string $langcode - * The language code for the translations. - * @param string $context - * (optional) The context for the translations. - * - * @depricated Use addPluralTranslation() instead. - */ - public function addPlural($singular_source, $singular_translated, $plural_source, $plural_translated, $langcode, $context = ''); - /** * Adds translation for plural strings. * diff --git a/tests/src/Kernel/TsiApiTest.php b/tests/src/Kernel/TsiApiTest.php index aaa5153..83e3fe2 100644 --- a/tests/src/Kernel/TsiApiTest.php +++ b/tests/src/Kernel/TsiApiTest.php @@ -76,6 +76,7 @@ class TsiApiTest extends KernelTestBase { $this->tsiService->addTranslation($source, $translated, $langcode); // Assert that the translated string is correct. + // @phpcs:ignore $this->assertEquals($translated, $this->t($source, [], ['langcode' => $langcode])); } @@ -97,6 +98,7 @@ class TsiApiTest extends KernelTestBase { // Assert that the translations were added successfully. foreach ($translation_array as $source => $translated) { + // @phpcs:ignore $this->assertEquals($translated, $this->t($source, [], ['langcode' => $langcode])); } } -- GitLab