Skip to content

19085-Translation-in-tier-price-phtml-not-working #19094

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

Conversation

agorbulin
Copy link

#19085:Translation in tier_price.phtml not working

Description (#19085 )

provided fix uses PHP translate instead of not working JS translate

Fixed Issues (if relevant)

  1. Translation in tier_price.phtml not working #19085:Translation in tier_price.phtml not working

Manual testing scenarios (*)

  1. Configure tier prices for configurable product (for his simples)
  2. Change translates for phrases in Magento/ConfigurableProduct/i18n/en_US.csv:
    "Buy %1 for %2 each and","Buy %1 for %2 each and"
    save,save
  3. Flush caches
  4. Go to PDP
  5. Choose option of configurable with tier prices
  6. Check translates

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

magento#19085:Translation in tier_price.phtml not working
@magento-engcom-team magento-engcom-team added Partner: ISM eCompany Pull Request is created by partner ISM eCompany partners-contribution Pull Request is created by Magento Partner Area: Frontend Component: ConfigurableProduct Release Line: 2.3 labels Nov 6, 2018
@magento-engcom-team
Copy link
Contributor

Hi @agorbulin. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@orlangur orlangur self-assigned this Nov 7, 2018
Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A possible workaround for this issue is to use <?php echo __() ?> instead but i don't think this is a proper solution for this issue.

Makes sense to me. So, @agorbulin, why JS translation is not working in this case in the first place?

@agorbulin
Copy link
Author

@orlangur
JS translation is not working in phtml files, because only JS files and HTML templates are parsed during generation js-translation.json, see here

$this->filesUtility->getJsFiles($areaCode, $themePath),

So, there are 2 solutions:

  • use PHP translates in phtml (I chose it)
  • move embed js to own js file and use js translation ($.mage.__())

@@ -15,9 +15,9 @@
+ '</span>'
+ '</span>'; %>
<li class="item">
<%= $t('Buy %1 for %2 each and').replace('%1', item.qty).replace('%2', priceStr) %>
<%= $t('<?= $block->escapeHtml(__('Buy %1 for %2 each and')) ?>').replace('%1', item.qty).replace('%2', priceStr) %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why JS translation $t is still here?

Copy link
Author

@agorbulin agorbulin Nov 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra $t removed, please check.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Nov 23, 2018
@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-3546 has been created to process this Pull Request

@agorbulin agorbulin mentioned this pull request Nov 24, 2018
4 tasks
@p-bystritsky p-bystritsky force-pushed the 19085-Translation-in-tier-price-phtml-not-working branch 2 times, most recently from 770da21 to 39f7462 Compare December 7, 2018 13:44
@p-bystritsky p-bystritsky force-pushed the 19085-Translation-in-tier-price-phtml-not-working branch from 39f7462 to 1a006b3 Compare December 7, 2018 15:35
@magento-engcom-team magento-engcom-team merged commit 1a006b3 into magento:2.3-develop Dec 21, 2018
@magento-engcom-team
Copy link
Contributor

Hi @agorbulin. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants