Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-backend
Controller
Adminhtml
Ajax
Translate.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Backend\Controller\Adminhtml\Ajax
;
8
9
use
Magento\Backend\App\Action
;
10
11
class
Translate
extends
\Magento\Backend\App\Action
12
{
16
protected
$inlineParser
;
17
21
protected
$resultJsonFactory
;
22
26
const
ADMIN_RESOURCE
=
'Magento_Backend::content_translation'
;
27
33
public
function
__construct
(
34
Action
\
Context
$context,
35
\
Magento
\Framework\
Translate
\
Inline
\ParserInterface
$inlineParser
,
36
\
Magento
\Framework\Controller\Result\JsonFactory
$resultJsonFactory
37
) {
38
parent::__construct($context);
39
$this->resultJsonFactory =
$resultJsonFactory
;
40
$this->inlineParser =
$inlineParser
;
41
}
42
48
public
function
execute
()
49
{
50
$translate = (array)$this->
getRequest
()->getPost(
'translate'
);
51
53
$resultJson = $this->resultJsonFactory->create();
54
try
{
55
$this->inlineParser->processAjaxPost($translate);
56
$response
= [
'success'
=>
'true'
];
57
}
catch
(\Exception $e) {
58
$response
= [
'error'
=>
'true'
,
'message'
=> $e->getMessage()];
59
}
60
61
$this->_actionFlag->set(
''
, self::FLAG_NO_POST_DISPATCH,
true
);
62
return
$resultJson->setData(
$response
);
63
}
64
}
$response
$response
Definition:
404.php:11
Magento\Framework\Translate\Inline
Definition:
ConfigInterface.php:6
Magento\Backend\Controller\Adminhtml\Ajax\Translate\ADMIN_RESOURCE
const ADMIN_RESOURCE
Definition:
Translate.php:26
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Backend\App\Action
Definition:
Action.php:17
Magento\Backend\Controller\Adminhtml\Ajax\Translate\__construct
__construct(Action\Context $context, \Magento\Framework\Translate\Inline\ParserInterface $inlineParser, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory)
Definition:
Translate.php:33
Magento\Backend\Controller\Adminhtml\Ajax\Translate\$resultJsonFactory
$resultJsonFactory
Definition:
Translate.php:21
Magento\Backend\Controller\Adminhtml\Ajax\Translate\$inlineParser
$inlineParser
Definition:
Translate.php:16
Magento
Magento\Backend\Controller\Adminhtml\Ajax\Translate
Definition:
Translate.php:11
Magento\Backend\App\Action\Context
Definition:
Context.php:25
Magento\Backend\App\Action
Definition:
Context.php:6
Magento\Backend\Controller\Adminhtml\Ajax
Definition:
Translate.php:7