I have 2 store views (english and another language) in one of my Magento 2 projects.
The problem I'm facing is that one of the categories has the name "Role", which is also an English word.
So when I visit the category view
page the category title gets translated to the other language's equivalent of the word "Role".
Shouldn't page/category headings be non-translatable through the built-in CSV translation mechanism that Magento provides?
I mean they already are translatable through the Admin store view functionality...
In any case, I've tracked this down to Magento_Theme::html/title.phtml
and the function getPageHeading()
in module-theme/Block/Html/Title.php
public function getPageHeading()
{
if (!empty($this->pageTitle)) {
return __($this->pageTitle);
}
return __($this->pageConfig->getTitle()->getShortHeading());
}
Is it possible to disable the translation via catalog_category_view.xml
with a referenceBlock name="page.main.title"
?
The only solution I can think of atm is to remove the page.main.title
block from category view
pages and add the non-translated title in Magento_Catalog::product/list.phtml
.
EDIT
I fixed this temporarily by removing the page.main.title
block and inserting this to list.phtml
:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');
if ($category) { ?>
<h1><?php echo $category->getName(); ?></h1>
<?php } ?>
But this isn't the best solution...
Seems like a Magento 2.2. bug to me.
Any suggestions would be appreciated.