Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page.main.title is translating title #7065

Closed
koenner01 opened this issue Oct 18, 2016 · 6 comments
Closed

page.main.title is translating title #7065

koenner01 opened this issue Oct 18, 2016 · 6 comments
Assignees
Labels
bug report Component: Translation Event: distributed-cd Distributed Contribution Day Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: PR Created Indicates that Pull Request has been created to fix issue Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@koenner01
Copy link
Contributor

koenner01 commented Oct 18, 2016

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.

@sevos1984
Copy link
Contributor

Thanks for reporting, internal ticket created MAGETWO-59860

@sevos1984 sevos1984 removed their assignment Oct 19, 2016
@sevos1984 sevos1984 added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Oct 19, 2016
@hostep
Copy link
Contributor

hostep commented Feb 6, 2017

Running into the same problem over here using Magento CE 2.1.2

A client of ours uses these abstract names for their product, like 'Time' or 'Guest', and they are getting translated in the title on the product detail view, which looks really silly.

Worked around it with a custom interceptor on the \Magento\Theme\Block\Html\Title class:

    private $request;

    public function __construct(\Magento\Framework\App\Request\Http $request)
    {
        $this->request = $request;
    }

    public function afterGetPageHeading(\Magento\Theme\Block\Html\Title $subject, $result)
    {
        if ($this->request->getFullActionName() == 'catalog_product_view')
        {
            if (!empty($subject->getPageTitle()))
            {
                return $subject->getPageTitle();
            }
        }

        return $result;
    }

Would be great if this issue could get some attention :)

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Component: Translation labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Sep 29, 2017
@magento-engcom-team
Copy link
Contributor

@koenner01, thank you for your report.
We've created internal ticket(s) MAGETWO-59860 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 11, 2017
@adrian-martinez-interactiv4
Copy link
Contributor

@koenner01 @hostep PR opened to try to fix this issue in 2.3-develop, when accepted, I will backport it to 2.2-develop and 2.1-develop

@magento-engcom-team magento-engcom-team added the Event: distributed-cd Distributed Contribution Day label Mar 19, 2018
@ghost ghost assigned Bartlomiejsz Jan 5, 2020
@Bartlomiejsz Bartlomiejsz added the Progress: PR Created Indicates that Pull Request has been created to fix issue label Jan 5, 2020
Bartlomiejsz added a commit to Bartlomiejsz/magento2 that referenced this issue Jan 7, 2020
@VladimirZaets
Copy link
Contributor

Hi @koenner01. Thank you for your report.
The issue has been fixed in #26269 by @Bartlomiejsz in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

@VladimirZaets VladimirZaets added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jan 17, 2020
magento-engcom-team added a commit that referenced this issue Jan 17, 2020
 - Merge Pull Request #26269 from Bartlomiejsz/magento2:feature/fix_7065_page_main_title_is_translating
 - Merged commits:
   1. 8fe06ff
@hostep
Copy link
Contributor

hostep commented Apr 20, 2020

Looks like a fix for this is also coming in Magento 2.3.5 (not 100% sure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Translation Event: distributed-cd Distributed Contribution Day Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: PR Created Indicates that Pull Request has been created to fix issue Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

10 participants