Skip to content

Translate attribute label with default translation helper function #13251

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

Merged
merged 2 commits into from
Feb 7, 2018
Merged

Conversation

cmuench
Copy link
Contributor

@cmuench cmuench commented Jan 18, 2018

Adds the translation function to customer attribute labels in Magento
admin. This gives a chance to translate a label in the locale of a
backend user.

Description

A custom attribute is created.
We have different frontend labels for the attribute. Store views with different locale settings exist.
Admin users are speaking different languages and need a localized attribute label.
This is not possible.

Fixed Issues (if relevant)

  1. Translate attribute label with default translation helper function #13251: Unable to translate custom attributes in admin backend

Manual testing scenarios

  1. Create an custom attribute with different frontend labels.

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)

Adds the translation function to customer attribute labels in Magento
admin. This gives a chance to translate a label in the locale of a
backend user.
@miguelbalparda
Copy link
Contributor

@cmuench can you check the build please? It seems new Phrase('') is the line causing them to fail.

@cmuench
Copy link
Contributor Author

cmuench commented Jan 18, 2018

@miguelbalparda Yes, I will check this.

@cmuench
Copy link
Contributor Author

cmuench commented Jan 18, 2018

@miguelbalparda I checked the failing test. It is indirectly caused by my change.
The test mocks components. Then in the test setup a generator is created by calling ServiceLocator::getDictionaryGenerator(). This loads ALL components of the system. In my case >12.000 files are scanned. This slows down the complete test execution and creates a lot of IOs on my disk.
I try to fix this test.

@cmuench
Copy link
Contributor Author

cmuench commented Jan 18, 2018

@miguelbalparda I "fixed" the test not my code. Now the failing test runs in ~30ms instead of 25 seconds. My patch will speed up the complete test environment.

This test tries to setup a test environment with two modules and one
theme to test the generator.
During the test run, the test environment and the complete module stack
is processed by the generator.
So the test takes on my machine 25 seconds with xdebug enabled.
After resetting the registrar the complete test runs in ~50ms with
xdebug enabled.
Without the reset ~12.000 files are scanned. With the reset only 5 files
are scanned.

This test is not a unit test. It is an integration test.
@miguelbalparda
Copy link
Contributor

Please don't insult other's people work. I've edited your comment. Thanks for the fix, we'll check it and report back.

@cmuench
Copy link
Contributor Author

cmuench commented Jan 19, 2018

@miguelbalparda You should know me. I never insult any developers work. I only hate the written code. Every developer should hate the own written code and improve it. With this code I had some issues in a project.

@dmanners dmanners self-assigned this Feb 1, 2018
@dmanners dmanners added this to the February 2018 milestone Feb 1, 2018
@magento-engcom-team
Copy link
Contributor

@cmuench thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@cmuench
Copy link
Contributor Author

cmuench commented Feb 1, 2018

@magento-engcom-team Thanks, but the link is always redirecting me to https://github.com/magento/

@vitmarks
Copy link

Hello, I wanted to ask, whether this issue was fixed?
I still have this problem. I'am using magento 2.3 beta 2
and I created some attributes with different labels, but If I switch to another backend user with configurated language FR, I still see all my attributes as Default labeled.

Did I miss something?
If there is not a fix til now, is there a quick fix (workaround), that I can implement for now?

thx

@Ctucker9233
Copy link

@magento-engcom-team is there a backport to 2.2 for this?

@cmuench cmuench deleted the fix/13250 branch March 12, 2019 08:12
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.

6 participants