Skip to content

page.main.title is translating title #7065

Closed
@koenner01

Description

@koenner01

The page.main.title block is translating the title. This can lead to unwanted results (like the product name being translated...)

Preconditions

  1. MG2.1 CE
  2. PHP7.0

Steps to reproduce

  1. Create a product with the name 'Save'
  2. Create a storeview that doesn't use english as locale (I'm using nl_NL as example)
  3. Go to the product detail page

Expected result

  1. The page title in page.main.title should be 'Save'

Actual result

  1. The page title in page.main.title is 'Opslaan' (dutch translation for save)

I traced this back to \Magento\Theme\Block\Html\Title.
Both the getPageTitle() and getPageHeading() function are wrapping the output in the magic translation function. Because of this the product name is being translated.

public function getPageTitle()
{
    if (!empty($this->pageTitle)) {
        return $this->pageTitle;
    }
    return __($this->pageConfig->getTitle()->getShort());
}

public function getPageHeading()
{
    if (!empty($this->pageTitle)) {
        return __($this->pageTitle);
    }
    return __($this->pageConfig->getTitle()->getShortHeading());
}

I'm pretty sure the translation here can be dropped all together because you can control the page titles from either the layout xml's or through the backend on storeview values.

Metadata

Metadata

Assignees

Labels

Component: TranslationEvent: distributed-cdDistributed Contribution DayFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentProgress: PR CreatedIndicates that Pull Request has been created to fix issueReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions