Ability to add Translation for CMS page and CMS block. Added translation as a custom variable. #164 #506

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
3 participants
Collaborator

miguelbalparda commented Feb 16, 2014

Translate CMS Pages in Magento.

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:
translation

@miguelbalparda miguelbalparda commented on the diff Feb 16, 2014

...ento/Backend/Controller/Adminhtml/System/Variable.php
@@ -218,9 +218,12 @@ public function deleteAction()
*/
public function wysiwygPluginAction()
{
- $customVariables = $this->_objectManager->create('Magento\Core\Model\Variable')->getVariablesOptionArray(true);
+ $variablesModel = $this->_objectManager->create('Magento\Core\Model\Variable');
@miguelbalparda

miguelbalparda Feb 16, 2014

Collaborator

Removed double call to $this->_objectManager->create('Magento\Core\Model\Variable') and changed name of var to variablesModel instead of variables.

tanya-soroka self-assigned this Feb 18, 2014

Hello @miguelbalparda, thank you for submit this suggestion!
We have already discussed this improvement and added to our product backlog.
We will review your code changes and provide our feedback.

Collaborator

miguelbalparda commented Feb 18, 2014

Thank you @tanya-soroka! I will add 2 more comments tomorrow to clarify my code so its easy to re use.

@miguelbalparda miguelbalparda commented on the diff Feb 18, 2014

app/code/Magento/Core/Model/Variable.php
@@ -159,6 +159,27 @@ public function validate()
}
/**
+ * Retrieve translation option
+ *
+ * @param bool $withGroup
+ * @return array
+ */
+ public function getTranslateVariablesOptionArray($withGroup = false)
+ {
+ $optionArray[] = array(
@miguelbalparda

miguelbalparda Feb 18, 2014

Collaborator

$optionArray[] may be be used as $optionArray

@miguelbalparda miguelbalparda commented on the diff Feb 18, 2014

app/code/Magento/Widget/Model/Template/Filter.php
@@ -126,4 +126,17 @@ public function widgetDirective($construction)
return $widget->toHtml();
}
+
+ /**
+ * Generate translatable text
+ *
+ * @param array $construction
+ * @return __
+ */
+ public function translateDirective($construction)
@miguelbalparda

miguelbalparda Feb 18, 2014

Collaborator

The actual translateDirective() function is placed here due to a previous extension i made for Magento 1. In the Magento 1 extension it was here because the module class extended Mage_Widget_Model_Template_Filter for not losing the {{widget ...}} directive.

Hello @miguelbalparda. Thank your submission.
We are going to make additional changes in the scope of the i18n implementation, so your request will be added after changes complete. Due to other priorities, it is unlikely that we will be able to include it in the initial Magento 2.0 release, but we will consider it for a follow-on release.

Thank you for your

Contributor

maksek commented Dec 26, 2014

Hi @miguelbalparda, thank you for you contribution. Can you please review the PR and resubmit it with latest code into develop branch. Thanks you.

@maksek maksek assigned maksek and unassigned tanya-soroka Dec 26, 2014

Collaborator

miguelbalparda commented Dec 26, 2014

Done @maksek, see #875

@magento-team magento-team pushed a commit that referenced this pull request Apr 3, 2016

@kandy kandy Merge pull request #506 from magento-dragons/PR
[Dragons] Bugfixes
06c96e9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment