Skip to content

Commit

Permalink
add change from migration
Browse files Browse the repository at this point in the history
  • Loading branch information
ArrayIterator committed Oct 15, 2023
1 parent a02b487 commit 6dd0a3e
Show file tree
Hide file tree
Showing 74 changed files with 418 additions and 4,715 deletions.
37 changes: 37 additions & 0 deletions Abstracts/CoreSubmoduleAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use ArrayAccess\TrayDigita\Module\Modules;
use ArrayAccess\TrayDigita\Module\Traits\ModuleTrait;
use function debug_backtrace;
use function func_get_args;
use function sprintf;
use const DEBUG_BACKTRACE_IGNORE_ARGS;

Expand Down Expand Up @@ -63,4 +64,40 @@ public function translatePlural(
): string {
return $this->core->translatePlural(...func_get_args());
}
/**
* Translate context
*
* @param string $original
* @param string $context
* @param string $domain
* @return string
* @see TranslatorInterface::translateContext()
*/
public function translateContext(
string $original,
string $context,
string $domain = TranslatorInterface::DEFAULT_DOMAIN,
): string {
return $this->core->translateContext(...func_get_args());
}

/**
* Translate plural context
*
* @param string $singular
* @param string $plural
* @param int|float|numeric-string $number
* @param string $context
* @param string $domain
* @return string
*/
public function translatePluralContext(
string $singular,
string $plural,
int|float|string $number,
string $context,
string $domain = TranslatorInterface::DEFAULT_DOMAIN
) : string {
return $this->core->translatePluralContext(...func_get_args());
}
}
6 changes: 5 additions & 1 deletion Benchmarks/CoreModuleAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public function getName(): string
$this->translated = true;
return $this->name = $this
->getCore()
?->translate('Event', context: 'benchmark')??$this->name;
?->translateContext(
'Event',
'benchmark',
'core-module'
)??$this->name;
}

public function accepted(RecordInterface $record): bool
Expand Down
Empty file added Controllers/.gitkeep
Empty file.
26 changes: 16 additions & 10 deletions Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Controllers\Controllers;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\EducationalInstitution\EducationalInstitution;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Library\Library;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Media\Media;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Option\Option;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Posts\Posts;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Quiz\Quiz;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Roles\Roles;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Scheduler\Scheduler;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\ServiceInitializer\ServiceInitializer;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Templates\Templates;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Translator\Translator;
use ArrayAccess\TrayDigita\App\Modules\Core\SubModules\Users\Users;
use ArrayAccess\TrayDigita\Benchmark\Aggregator\EventAggregator;
use ArrayAccess\TrayDigita\Benchmark\Injector\ManagerProfiler;
use ArrayAccess\TrayDigita\Database\Connection;
use ArrayAccess\TrayDigita\L10n\Translations\Adapter\Gettext\PoMoAdapter;
use ArrayAccess\TrayDigita\Module\AbstractModule;
use ArrayAccess\TrayDigita\Traits\Service\TranslatorTrait;
use ArrayAccess\TrayDigita\Util\Filter\ContainerHelper;
Expand Down Expand Up @@ -61,16 +59,13 @@ final class Core extends AbstractModule
Controllers::class,
EducationalInstitution::class,
Library::class,
Media::class,
Option::class,
Posts::class,
Quiz::class,
Roles::class,
Scheduler::class,
ServiceInitializer::class,
Templates::class,
Translator::class,
Users::class,
];

/**
Expand All @@ -85,17 +80,19 @@ final class Core extends AbstractModule

public function getName(): string
{
return $this->translate(
return $this->translateContext(
'Core',
context: 'module'
'module',
'core-module'
);
}

public function getDescription(): string
{
return $this->translate(
return $this->translateContext(
'Main core module',
context: 'module'
'module',
'core-module'
);
}

Expand All @@ -105,6 +102,15 @@ protected function doInit(): void
return;
}

foreach ($this->getTranslator()?->getAdapters()??[] as $adapter) {
if ($adapter instanceof PoMoAdapter) {
$adapter->registerDirectory(
__DIR__ .'/Languages',
'core-module'
);
}
}

$this->didInit = true;
$this->doRegisterEntities();

Expand Down
197 changes: 0 additions & 197 deletions Entities/Admin.php

This file was deleted.

Loading

0 comments on commit 6dd0a3e

Please sign in to comment.