-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
refs Ability to add Translation for CMS pages and CMS blocks. #875
Conversation
* @param array $construction | ||
* @return string | ||
*/ | ||
public function translateDirective($construction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this method use?
@Sanuch that method is the one in charge of making the {{translate text="Text here"}} directive usable in pages/blocks. |
MAGETWO-32350 |
@miguelbalparda, so the issue you are trying to solve is that text content on CMS pages cannot be changed via inline translates. You suggest adding a custom variable and all text that you enter want translated on a page must be contained in this variable instance, right? I am just wondering how often people think of using inline translates to localize content of CMS pages? I guess this functionality was designed for a bit different purpose - for interface labels, not the content, so using inline translates for the page content is a bit weird as for me. What I am thinking of as a solution is to have similar approach to CMS pages as for products. In this way you would create content of a page and then replace the original (for example, English) text with Spanish, German, French etc. localized text having switched to a specific store view with all other content like widgets inserted on a page preserved. Please let me know your thoughts. |
I think the decision to translate or not CMS pages with a variable should not be taken but left to the Magento user. |
Hi @miguelbalparda. Why do you think CMS page must be translated the way? Usually for CMS you need to change webstore and create completely new CMS for it. At the same time if you use some variables they will be translated using locale. |
@maksek @miguelbalparda. Not really related to this issue, but still related to CMS translation. Why not make the CMS entities (pages, blocks) EAV with a flat indexer. My very custom and not so good solution is to have an additional internal field that acts as a common identifier. An EAV approach would solve these problems. |
@maksek i did validated this in a Magento 1 site and the site's performance was not impacted. I did not checked the impact on Magento 2, but in my opinion should be minimum. |
@miguelbalparda, since the Inline Translates functionality was designed for overriding interface labels localization and has no idea of localizing pages content behind, we do not consider having this functionality in Magento 2 core. Nevertheless, we highly encourage you to create an extension for Magento 2 in the same way you did for Magento 1, so community members preferring this way of localizing content on CMS pages would take advantage of your suggested functionality. |
Hi @tzyganu, interesting idea. Not sure if EAV makes sense in the specific case you described, maybe having 1 additional row with linkage is enough.EAV is heavyweight pattern and implementing him for CMS requires more complex case. But it is worth to be considered, i will contact product team. Thanks! |
@tzyganu, could you please provide the reason for the necessity of linking two pages (localized variations of the same page) assigned to different store views? From the SEO perspective, if I am not mistaken, even if you set the URL for both pages to be the same, if you go to Stores > Configuration > Web and enable the Add Store Codes to Urls setting, SE will be able to index both pages as their URLs will be different thanks to the store codes added to URLs. |
@verklov I can list here the impediments I found so far related to the CMS while working with M1. I'm not saying that an EAV approach would solve all the issues (maybe it will create others) but It has some advantages. Let's say I have 2 store views. EN and FR. (the problems are even worse for each store view added)
And most important maybe...having the CMS section behave like the catalog section I won't have to explain to the clients, why they need 2 pages, and why is done some way in one place and another way in the other place. I would just say, "You fill in some default values, then you change the from the top left corner and translate your page.". |
@tzyganu, we've looked at the issues that you mentioned in the previous comment. Here are the comments that I have based on what I understood:
Here are improvements I'd like to suggest to be done in scope of CMS to resolve issues that you and others have:
I am interested in your opinion regarding the suggested improvements I described. Could you please share your thoughts? Thank you! |
@verklov I'm 100% on board with your suggested improvements. Having a store view selector will help for sure the editors. It doesn't even need to be an EAV entity. If there selector is there it's enough (even if I can't still imagine how will that work if it's not EAV - but I trust you). And the auto URL rewrites would be a big help. |
Thank you for your feedback, @tzyganu! I really appreciate it. We will be discussing the technical details with the architects more to provide a better solution. Please feel free to suggest more of what's on your mind. Your suggestions are valuable source of information for us. |
I think in Magento2, CMS page and static block should be EAV entity instead of flat entity. So that it have store switcher ability same like product entity and page or static block can be translated within single entry (by switching store view). |
👍 |
Translate CMS Pages in Magento. New PR for #506 as requested by @maksek
Use: In any CMS Page or Block use {{translate text="Text here"}} and the text will be translatable with the Inline translator.
Also available as custom variable: