Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 3, 2021
1 parent a222289 commit c38d58f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 90 deletions.
21 changes: 0 additions & 21 deletions src/Translator/Adapter/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Atk4\Core\ConfigTrait;
use Atk4\Core\Translator\ITranslatorAdapter;
use Atk4\Data\Locale;

class Generic implements ITranslatorAdapter
{
Expand Down Expand Up @@ -83,32 +82,14 @@ protected function processMessagePlural($definition, array $parameters = [], int
*/
protected function getDefinition(string $message, string $domain, ?string $locale)
{
$this->loadDefinitionAtk($locale); // need to be called before manual add

return $this->definitions[$locale][$domain][$message] ?? null;
}

protected function loadDefinitionAtk(string $locale): void
{
if (isset($this->definitions[$locale]['atk'])) {
return;
}

$this->definitions[$locale]['atk'] = [];

if (class_exists(\Atk4\Data\Locale::class)) {
$path = Locale::getPath();
$this->addDefinitionFromFile($path . '/' . $locale . '/atk.php', $locale, 'atk', 'php');
}
}

/**
* Load definitions from file.
*/
public function addDefinitionFromFile(string $file, string $locale, string $domain, string $format): void
{
$this->loadDefinitionAtk($locale); // need to be called before manual add

$this->readConfig($file, $format);

$this->definitions = array_replace_recursive(
Expand All @@ -132,8 +113,6 @@ public function addDefinitionFromFile(string $file, string $locale, string $doma
*/
public function setDefinitionSingle(string $key, $definition, string $locale = 'en', string $domain = 'atk')
{
$this->loadDefinitionAtk($locale); // need to be called before manual add

if (is_string($definition)) {
$definition = [$definition];
}
Expand Down
65 changes: 0 additions & 65 deletions tests/LocalizationTest.php

This file was deleted.

4 changes: 0 additions & 4 deletions tests/TranslatorAdapterGenericTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Atk4\Core\TranslatableTrait;
use Atk4\Core\Translator\Adapter\Generic;
use Atk4\Core\Translator\Translator;
use Atk4\Data\Locale;

class TranslatorAdapterGenericTest extends TranslatorAdapterBase
{
Expand Down Expand Up @@ -60,9 +59,6 @@ public function testAdapter(): void
{
$adapter = new Generic();

// just to cover method addDefinitionFromFile
$adapter->addDefinitionFromFile(Locale::getPath() . '/en/atk.php', 'en', 'atk', 'php');

$adapter->setDefinitionSingle('test', 'custom definition', 'en', 'other');

Translator::instance()->setAdapter($adapter);
Expand Down

0 comments on commit c38d58f

Please sign in to comment.