doukucai0099 2018-09-21 08:14
浏览 108

商店视图中的Magento 2错误的语言环境(错误的翻译)

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.

http://joxi.ru/L21PjnVT8nvPJm

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.

  • 写回答

1条回答 默认 最新

  • donglugou6652 2019-01-09 09:23
    关注

    Have you tried running:

    bin/magento setup:static-content:deploy de_DE
    

    Possibly the non default stores didn't get it deployed.

    评论

报告相同问题?

悬赏问题

  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件