Reputation: 11
I have next problem.
I have 2 websites (German and Austria).
Websites have stores (German store and Austria store).
Each store have 2 store views (German-DE
, German-EN
, Austria-DE
, Austria-EN
).
German store and it's store view German-DE
is the default store and store view.
Now to the problem. Generally I need to have next translations:
Germany-DE - Germany language
;
Germany-EN - English language
;
Austria-DE - Germany language
;
Austria-EN - English language
;
In admin panel i made settings for Locale(Stores > Configuration > General >
): all English language store views have en_US
locale and all Germany language store views have de_DE
locale.
But, in Germany store all store views have right translation, but in Austria translation do not work... Generally Austria store have default store view Austria-EN
and all store views have english translation. When I switch default store view to Austria-DE, all Austria store views will translate to German. I try to get locale on frontend in some controller using Magento\Framework\Translate
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
\Magento\Framework\Translate $translate
)
{
$this->resultPageFactory = $resultPageFactory;
$this->translate = $translate;
parent::__construct($context);
}
public function execute()
{
var_dump($this->translate->getLocale());
die;
return $this->resultPageFactory->create();
}
and in Austria-DE I get en_US
when in locale of this store view is set de_DE
.
Please help me to figure it out what is the problem.
Upvotes: 1
Views: 1331
Reputation: 48
Have you tried running:
bin/magento setup:static-content:deploy de_DE
Possibly the non default stores didn't get it deployed.
Upvotes: 0