Skip to content

Commit

Permalink
* code reformat
Browse files Browse the repository at this point in the history
* Google Translate API URL was changed (now is "https://translation.googleapis.com/language/translate/v2")
  • Loading branch information
fballiano committed Mar 2, 2017
1 parent dc63d7a commit ad4aeae
Show file tree
Hide file tree
Showing 12 changed files with 260 additions and 254 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.7.3
-----
* code reformat
* Google Translate API URL was changed (now is "https://translation.googleapis.com/language/translate/v2")

0.7.2
-----
* mbstring extension is required (check added) if you use Google Translate API.
Expand Down
55 changes: 28 additions & 27 deletions app/code/community/Fballiano/FullCatalogTranslate/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* FBalliano
*
Expand Down Expand Up @@ -28,26 +29,26 @@ public function getAttributesToTranslate()
{
$attributes = Mage::getStoreConfig("fballiano_full_catalog_translate/general/attributes_to_translate");
$attributes = explode(",", $attributes);
foreach ($attributes as $k=>$v) {
foreach ($attributes as $k => $v) {
$attributes[$k] = trim($v);
}

return $attributes;
}

/**
* @return array
*/
public function getCategoryAttributesToTranslate()
{
$attributes = Mage::getStoreConfig("fballiano_full_catalog_translate/general/category_attributes_to_translate");
$attributes = explode(",", $attributes);
foreach ($attributes as $k=>$v) {
$attributes[$k] = trim($v);
}
/**
* @return array
*/
public function getCategoryAttributesToTranslate()
{
$attributes = Mage::getStoreConfig("fballiano_full_catalog_translate/general/category_attributes_to_translate");
$attributes = explode(",", $attributes);
foreach ($attributes as $k => $v) {
$attributes[$k] = trim($v);
}

return $attributes;
}
return $attributes;
}

/**
* @return string
Expand All @@ -57,19 +58,19 @@ public function getApiKey()
return Mage::getStoreConfig("fballiano_full_catalog_translate/google_translate/api_key");
}

/**
* @return string
*/
public function getTranslationSystem()
{
return Mage::getStoreConfig("fballiano_full_catalog_translate/general/translation_system");
}
/**
* @return string
*/
public function getTranslationSystem()
{
return Mage::getStoreConfig("fballiano_full_catalog_translate/general/translation_system");
}

/**
* @return string
*/
public function getCommand()
{
return Mage::getStoreConfig("fballiano_full_catalog_translate/custom/command");
}
/**
* @return string
*/
public function getCommand()
{
return Mage::getStoreConfig("fballiano_full_catalog_translate/custom/command");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* FBalliano
*
Expand All @@ -19,7 +20,6 @@
* @copyright Copyright (c) 2014 Fabrizio Balliano (http://fabrizioballiano.it)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Fballiano_FullCatalogTranslate_Model_TranslatableAttributes
{
public function toOptionArray()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* FBalliano
*
Expand All @@ -19,7 +20,6 @@
* @copyright Copyright (c) 2014 Fabrizio Balliano (http://fabrizioballiano.it)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Fballiano_FullCatalogTranslate_Model_TranslatableCategoryAttributes
{
public function toOptionArray()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* FBalliano
*
Expand All @@ -19,20 +20,19 @@
* @copyright Copyright (c) 2014 Fabrizio Balliano (http://fabrizioballiano.it)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Fballiano_FullCatalogTranslate_Model_TranslationSystems
{
public function toOptionArray()
{
$toreturn = array();
$toreturn[] = array(
"value" => "googletranslate",
"label" => "Google Translate"
);
$toreturn[] = array(
"value" => "custom",
"label" => "Custom"
);
$toreturn[] = array(
"value" => "googletranslate",
"label" => "Google Translate"
);
$toreturn[] = array(
"value" => "custom",
"label" => "Custom"
);

return $toreturn;
}
Expand Down
38 changes: 19 additions & 19 deletions app/code/community/Fballiano/FullCatalogTranslate/etc/adminhtml.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<fballiano_full_catalog_translate>
<title>FBalliano Full Catalog Translate</title>
</fballiano_full_catalog_translate>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<fballiano_full_catalog_translate>
<title>FBalliano Full Catalog Translate</title>
</fballiano_full_catalog_translate>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
64 changes: 32 additions & 32 deletions app/code/community/Fballiano/FullCatalogTranslate/etc/config.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<?xml version="1.0"?>
<config>
<modules>
<Fballiano_FullCatalogTranslate>
<version>0.7.0</version>
</Fballiano_FullCatalogTranslate>
</modules>
<global>
<helpers>
<fballiano_fullcatalogtranslate>
<class>Fballiano_FullCatalogTranslate_Helper</class>
</fballiano_fullcatalogtranslate>
</helpers>
<models>
<fballiano_fullcatalogtranslate>
<class>Fballiano_FullCatalogTranslate_Model</class>
</fballiano_fullcatalogtranslate>
</models>
<resources>
<fballiano_fullcatalogtranslate_setup>
<setup>
<module>Fballiano_FullCatalogTranslate</module>
<class>Mage_Catalog_Model_Resource_Setup</class>
</setup>
</fballiano_fullcatalogtranslate_setup>
</resources>
</global>
<default>
<fballiano_full_catalog_translate>
<general>
<modules>
<Fballiano_FullCatalogTranslate>
<version>0.7.3</version>
</Fballiano_FullCatalogTranslate>
</modules>
<global>
<helpers>
<fballiano_fullcatalogtranslate>
<class>Fballiano_FullCatalogTranslate_Helper</class>
</fballiano_fullcatalogtranslate>
</helpers>
<models>
<fballiano_fullcatalogtranslate>
<class>Fballiano_FullCatalogTranslate_Model</class>
</fballiano_fullcatalogtranslate>
</models>
<resources>
<fballiano_fullcatalogtranslate_setup>
<setup>
<module>Fballiano_FullCatalogTranslate</module>
<class>Mage_Catalog_Model_Resource_Setup</class>
</setup>
</fballiano_fullcatalogtranslate_setup>
</resources>
</global>
<default>
<fballiano_full_catalog_translate>
<general>
<translation_system>googletranslate</translation_system>
<attributes_to_translate>name,short_description,description,meta_title,meta_keyword,meta_description</attributes_to_translate>
<attributes_to_translate>name,short_description,description,meta_title,meta_keyword,meta_description</attributes_to_translate>
<category_attributes_to_translate>name,description,meta_title,meta_keyword,meta_description</category_attributes_to_translate>
</general>
</fballiano_full_catalog_translate>
</default>
</general>
</fballiano_full_catalog_translate>
</default>
</config>
88 changes: 44 additions & 44 deletions app/code/community/Fballiano/FullCatalogTranslate/etc/system.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0"?>
<config>
<sections>
<fballiano_full_catalog_translate>
<tab>service</tab>
<label>Fballiano Full Catalog Translate</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<groups>
<general>
<label>General</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>10</sort_order>
<fields>
<sections>
<fballiano_full_catalog_translate>
<tab>service</tab>
<label>Fballiano Full Catalog Translate</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<groups>
<general>
<label>General</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>10</sort_order>
<fields>
<translation_system>
<label>Translation system</label>
<show_in_default>1</show_in_default>
Expand All @@ -24,16 +24,16 @@
<source_model>fballiano_fullcatalogtranslate/translationSystems</source_model>
<sort_order>40</sort_order>
</translation_system>
<attributes_to_translate>
<label>Attributes to translate</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<frontend_type>multiselect</frontend_type>
<source_model>fballiano_fullcatalogtranslate/translatableAttributes</source_model>
<comment>Only these attributes will be translated.</comment>
<attributes_to_translate>
<label>Attributes to translate</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<frontend_type>multiselect</frontend_type>
<source_model>fballiano_fullcatalogtranslate/translatableAttributes</source_model>
<comment>Only these attributes will be translated.</comment>
<sort_order>20</sort_order>
</attributes_to_translate>
</attributes_to_translate>
<category_attributes_to_translate>
<label>Attributes to translate (for categories)</label>
<show_in_default>1</show_in_default>
Expand All @@ -44,23 +44,23 @@
<comment>Only these attributes will be translated.</comment>
<sort_order>30</sort_order>
</category_attributes_to_translate>
</fields>
</general>
<google_translate>
<label>Google Translate</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>20</sort_order>
<fields>
<api_key>
<label>API key</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</api_key>
</fields>
</google_translate>
</fields>
</general>
<google_translate>
<label>Google Translate</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>20</sort_order>
<fields>
<api_key>
<label>API key</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</api_key>
</fields>
</google_translate>
<custom>
<label>Custom translation system</label>
<show_in_default>1</show_in_default>
Expand All @@ -77,7 +77,7 @@
</command>
</fields>
</custom>
</groups>
</fballiano_full_catalog_translate>
</sections>
</groups>
</fballiano_full_catalog_translate>
</sections>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"type" => "int",
"default" => "0",
"label" => "Translate automatically?",
"note"=> "Should this product be translated automatically when the store admin decides so?",
"note" => "Should this product be translated automatically when the store admin decides so?",
"input" => "select",
'source' => 'eav/entity_attribute_source_boolean',
"global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
Expand Down
Loading

0 comments on commit ad4aeae

Please sign in to comment.