This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace Esun\Translation\Controller\Adminhtml\Translate;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\View\Result\PageFactory;
class Index extends Action
{
public const ADMIN_RESOURCE = 'Magento_Backend::admin';
public function __construct(
Context $context,
private readonly PageFactory $pageFactory
) {
parent::__construct($context);
}
public function execute(): ResultInterface
{
$page = $this->pageFactory->create();
$page->getConfig()->getTitle()->prepend(__('Esun Translation'));
return $page;
}
protected function _isAllowed(): bool
{
return $this->_authorization->isAllowed($this->getTranslateResource());
}
private function getTranslateResource(): string
{
return match ((string)$this->getRequest()->getParam('entity_type', 'product')) {
'cms_page' => 'Esun_Translation::translate_cms_page',
'cms_block' => 'Esun_Translation::translate_cms_block',
default => 'Esun_Translation::translate_product',
};
}
}