Solwin_GoogleLangTranslator - Version 1.0.0

Version Notes

Solwin custom google translate extension for translation your whole website easily.

Download this release

Release Info

Developer Sanjay Dabhoya
Extension Solwin_GoogleLangTranslator
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Solwin/GoogleLangTranslator/Block/Index.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Solwin_GoogleLangTranslator_Block_Index extends Mage_Core_Block_Template{
3
+
4
+
5
+
6
+
7
+
8
+ }
app/code/community/Solwin/GoogleLangTranslator/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Solwin_GoogleLangTranslator_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
5
+
app/code/community/Solwin/GoogleLangTranslator/Model/System/Config/Source/Language.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Solwin_GoogleLangTranslator_Model_System_Config_Source_Language {
4
+
5
+ public function toOptionArray() {
6
+ $languages = array(
7
+ array('label' => 'Afrikaans', 'value' => 'af'),
8
+ array('label' => 'Albanian', 'value' => 'sq'),
9
+ array('label' => 'Arabic', 'value' => 'ar'),
10
+ array('label' => 'Amharic', 'value' => 'am'),
11
+ array('label' => 'Armenian', 'value' => 'hy'),
12
+ array('label' => 'Azerbaijani', 'value' => 'az'),
13
+ array('label' => 'Basque', 'value' => 'eu'),
14
+ array('label' => 'Belarusian', 'value' => 'be'),
15
+ array('label' => 'Bengali', 'value' => 'bn'),
16
+ array('label' => 'Bosnian', 'value' => 'bs'),
17
+ array('label' => 'Bulgarian', 'value' => 'bg'),
18
+ array('label' => 'Catalan', 'value' => 'ca'),
19
+ array('label' => 'Cebuano', 'value' => 'ceb'),
20
+ array('label' => 'Chichewa', 'value' => 'ny'),
21
+ array('label' => 'Chinese', 'value' => 'zh-CN'),
22
+ array('label' => 'Chinese (Simplified)', 'value' => 'zh-CN'),
23
+ array('label' => 'Chinese (Traditional)', 'value' => 'zh-TW'),
24
+ array('label' => 'Croatian', 'value' => 'hr'),
25
+ array('label' => 'Czech', 'value' => 'cs'),
26
+ array('label' => 'Danish', 'value' => 'da'),
27
+ array('label' => 'Dutch', 'value' => 'nl'),
28
+ array('label' => 'English', 'value' => 'en'),
29
+ array('label' => 'Esperanto', 'value' => 'eo'),
30
+ array('label' => 'Estonian', 'value' => 'et'),
31
+ array('label' => 'Filipino', 'value' => 'tl'),
32
+ array('label' => 'Faroese', 'value' => 'fo'),
33
+ array('label' => 'Finnish', 'value' => 'fi'),
34
+ array('label' => 'French', 'value' => 'fr'),
35
+ array('label' => 'Galician', 'value' => 'gl'),
36
+ array('label' => 'Georgian', 'value' => 'ka'),
37
+ array('label' => 'German', 'value' => 'de'),
38
+ array('label' => 'Greek', 'value' => 'el'),
39
+ array('label' => 'Gujarati', 'value' => 'gu'),
40
+ array('label' => 'Haitian', 'value' => 'ht'),
41
+ array('label' => 'Hausa', 'value' => 'ha'),
42
+ array('label' => 'Hebrew', 'value' => 'iw'),
43
+ array('label' => 'Hindi', 'value' => 'hi'),
44
+ array('label' => 'Hmong', 'value' => 'hmn'),
45
+ array('label' => 'Hungarian', 'value' => 'hu'),
46
+ array('label' => 'Icelandic', 'value' => 'is'),
47
+ array('label' => 'Igbo', 'value' => 'ig'),
48
+ array('label' => 'Indonesian', 'value' => 'id'),
49
+ array('label' => 'Irish', 'value' => 'ga'),
50
+ array('label' => 'Italian', 'value' => 'it'),
51
+ array('label' => 'Japanese', 'value' => 'ja'),
52
+ array('label' => 'Javanese', 'value' => 'jv'),
53
+ array('label' => 'Kannada', 'value' => 'kn'),
54
+ array('label' => 'Khmer', 'value' => 'km'),
55
+ array('label' => 'Korean', 'value' => 'ko'),
56
+ array('label' => 'Kazakh', 'value' => 'kk'),
57
+ array('label' => 'Lao', 'value' => 'lo'),
58
+ array('label' => 'Latin', 'value' => 'la'),
59
+ array('label' => 'Latvian', 'value' => 'lv'),
60
+ array('label' => 'Lithuanian', 'value' => 'lt'),
61
+ array('label' => 'Macedonian', 'value' => 'mk'),
62
+ array('label' => 'Malay', 'value' => 'ms'),
63
+ array('label' => 'Malagasy', 'value' => 'mg'),
64
+ array('label' => 'Maltese', 'value' => 'mt'),
65
+ array('label' => 'Maori', 'value' => 'mi'),
66
+ array('label' => 'Marathi', 'value' => 'mr'),
67
+ array('label' => 'Malayalam', 'value' => 'ml'),
68
+ array('label' => 'Mongolian', 'value' => 'mn'),
69
+ array('label' => 'Norwegian', 'value' => 'no'),
70
+ array('label' => 'Nepali', 'value' => 'ne'),
71
+ array('label' => 'Persian', 'value' => 'fa'),
72
+ array('label' => 'Polish', 'value' => 'pl'),
73
+ array('label' => 'Portuguese', 'value' => 'pt'),
74
+ array('label' => 'Punjabi', 'value' => 'pa'),
75
+ array('label' => 'Romanian', 'value' => 'ro'),
76
+ array('label' => 'Russian', 'value' => 'ru'),
77
+ array('label' => 'Serbian', 'value' => 'sr'),
78
+ array('label' => 'Slovak', 'value' => 'sk'),
79
+ array('label' => 'Slovenian', 'value' => 'sl'),
80
+ array('label' => 'Sesotho', 'value' => 'st'),
81
+ array('label' => 'Somali', 'value' => 'so'),
82
+ array('label' => 'Sinhalese', 'value' => 'si'),
83
+ array('label' => 'Spanish', 'value' => 'es'),
84
+ array('label' => 'Swahili', 'value' => 'sw'),
85
+ array('label' => 'Sundanese', 'value' => 'su'),
86
+ array('label' => 'Swedish', 'value' => 'sv'),
87
+ array('label' => 'Tajik', 'value' => 'tg'),
88
+ array('label' => 'Tamil', 'value' => 'ta'),
89
+ array('label' => 'Telugu', 'value' => 'te'),
90
+ array('label' => 'Thai', 'value' => 'th'),
91
+ array('label' => 'Turkish', 'value' => 'tr'),
92
+ array('label' => 'Ukrainian', 'value' => 'uk'),
93
+ array('label' => 'Urdu', 'value' => 'ur'),
94
+ array('label' => 'Uzbek', 'value' => 'uz'),
95
+ array('label' => 'Vietnamese', 'value' => 'vi'),
96
+ array('label' => 'Welsh', 'value' => 'cy'),
97
+ array('label' => 'Xhosa', 'value' => 'xh'),
98
+ array('label' => 'Yiddish', 'value' => 'yi'),
99
+ array('label' => 'Yoruba', 'value' => 'yo'),
100
+ array('label' => 'Zulu', 'value' => 'zu'),
101
+ );
102
+ return $languages;
103
+ }
104
+
105
+ }
app/code/community/Solwin/GoogleLangTranslator/Model/System/Config/Source/Layout.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Solwin_GoogleLangTranslator_Model_System_Config_Source_Layout {
4
+
5
+ public function toOptionArray() {
6
+ $layouts = array(
7
+ array('label' => '----------Select a Layout for Dropdown-----------', 'value' => '0'),
8
+ array('label' => 'Simple Layout', 'value' => 'SIMPLE'),
9
+ array('label' => 'Verticle Layout', 'value' => 'VERTICLE'),
10
+ array('label' => 'Horizontal Layout', 'value' => 'HORIZONTAL'),
11
+ );
12
+ return $layouts;
13
+ }
14
+
15
+ }
app/code/community/Solwin/GoogleLangTranslator/controllers/IndexController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Solwin_GoogleLangTranslator_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function IndexAction() {
4
+
5
+ $this->loadLayout();
6
+
7
+ $this->renderLayout();
8
+
9
+ }
10
+ }
app/code/community/Solwin/GoogleLangTranslator/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <solwintransec translate="title" module="googlelangtranslator">
12
+ <title>Configuration Section</title>
13
+ <sort_order>0</sort_order>
14
+ </solwintransec>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Solwin/GoogleLangTranslator/etc/config.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Solwin_GoogleLangTranslator>
5
+ <version>1.0.0</version>
6
+ </Solwin_GoogleLangTranslator>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <googlelangtranslator>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Solwin_GoogleLangTranslator</module>
14
+ <frontName>googlelangtranslator</frontName>
15
+ </args>
16
+ </googlelangtranslator>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <googlelangtranslator>
21
+ <file>googlelangtranslator.xml</file>
22
+ </googlelangtranslator>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <googlelangtranslator>
29
+ <class>Solwin_GoogleLangTranslator_Helper</class>
30
+ </googlelangtranslator>
31
+ </helpers>
32
+ <models>
33
+ <googlelangtranslator>
34
+ <class>Solwin_GoogleLangTranslator_Model</class>
35
+ </googlelangtranslator>
36
+ </models>
37
+ <blocks>
38
+ <googlelangtranslator>
39
+ <class>Solwin_GoogleLangTranslator_Block</class>
40
+ </googlelangtranslator>
41
+ </blocks>
42
+ </global>
43
+ </config>
app/code/community/Solwin/GoogleLangTranslator/etc/system.xml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <solwintrans translate="label" module="googlelangtranslator">
5
+ <label>Solwin</label>
6
+ <sort_order>150</sort_order>
7
+ </solwintrans>
8
+ </tabs>
9
+ <sections>
10
+ <solwintransec translate="label" module="googlelangtranslator">
11
+ <label>Solwin Google Translate</label>
12
+ <tab>solwintrans</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>150</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <solwintransgroup translate="label">
20
+ <label>General</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enable translate="label">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </enable>
36
+ <enable_custom translate="label">
37
+ <label>Include Your Custom Code?</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>11</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <depends>
45
+ <enable>1</enable>
46
+ </depends>
47
+ </enable_custom>
48
+ <selectlanguage translate="label">
49
+ <label>Select Language</label>
50
+ <frontend_type>multiselect</frontend_type>
51
+ <source_model>googlelangtranslator/system_config_source_language</source_model>
52
+ <sort_order>12</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <comment>Select languages for translation.</comment>
57
+ <depends>
58
+ <enable>1</enable>
59
+ <enable_custom>0</enable_custom>
60
+ </depends>
61
+ </selectlanguage>
62
+ <selectlayout>
63
+ <label>Select Layout of Custom Dropdown</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>googlelangtranslator/system_config_source_layout</source_model>
66
+ <sort_order>13</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <comment>For custom dropdown.</comment>
71
+ <depends>
72
+ <enable>1</enable>
73
+ <enable_custom>0</enable_custom>
74
+ </depends>
75
+ </selectlayout>
76
+ <snippet translate="label">
77
+ <label>Custom Code</label>
78
+ <frontend_type>textarea</frontend_type>
79
+ <sort_order>20</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ <comment>To replace custom language option and to show all languages write this. Please visit https://translate.google.com/manager/website/add For Snippet code</comment>
84
+ <depends>
85
+ <enable>1</enable>
86
+ <enable_custom>1</enable_custom>
87
+ </depends>
88
+ </snippet>
89
+ </fields>
90
+ </solwintransgroup>
91
+ </groups>
92
+ </solwintransec>
93
+ </sections>
94
+ </config>
app/design/frontend/default/default/layout/googlelangtranslator.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="store_language">
5
+ <action method="setTemplate">
6
+ <template>googlelangtranslator/index.phtml</template>
7
+ </action>
8
+ </reference>
9
+ </default>
10
+ </layout>
11
+
app/design/frontend/default/default/template/googlelangtranslator/index.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $enabled = Mage::getStoreConfig('solwintransec/solwintransgroup/enable');
3
+ $selected = strtolower(Mage::getStoreConfig('solwintransec/solwintransgroup/selectlanguage'));
4
+ $layout = Mage::getStoreConfig('solwintransec/solwintransgroup/selectlayout');
5
+ $snippetenabel = Mage::getStoreConfig('solwintransec/solwintransgroup/enable_custom');
6
+ $snippet = Mage::getStoreConfig('solwintransec/solwintransgroup/snippet');
7
+
8
+ //get all option values from model function
9
+ $lanmodel = Mage::getModel('googlelangtranslator/system_config_source_language')->toOptionArray();
10
+
11
+ $exselect = explode(',', $selected);
12
+
13
+ if($layout){
14
+ $layouthtml = 'layout: google.translate.TranslateElement.InlineLayout.'.$layout;
15
+ }else{
16
+ $layouthtml = 'layout: google.translate.TranslateElement.InlineLayout.SIMPLE';
17
+ }
18
+ if ($enabled):
19
+ if ($snippetenabel && $snippet != "") {
20
+ ?>
21
+ <div class="form-language">
22
+ <?php echo $snippet; ?>
23
+ </div>
24
+ <?php
25
+ } else {
26
+ ?>
27
+ <div id="google_translate_element"></div>
28
+ <script type="text/javascript">
29
+ function googleTranslateElementInit()
30
+ {
31
+ new google.translate.TranslateElement(
32
+ {
33
+ pageLanguage: 'en',
34
+ includedLanguages: '<?php echo $selected; ?>',
35
+ <?php echo $layouthtml; ?>
36
+ },
37
+ 'google_translate_element');
38
+ }
39
+ </script>
40
+ <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
41
+ <?php
42
+ }
43
+ endif;
app/etc/modules/Solwin_GoogleLangTranslator.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Solwin_GoogleLangTranslator>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Solwin_GoogleLangTranslator>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Solwin_GoogleLangTranslator</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension will translate your whole website into any language you selected.</summary>
10
+ <description>A very useful extension to translate your website into any language.&#xD;
11
+ It will provide a custom language selector as well as a code snippet to insert your custom google translate code.&#xD;
12
+ You can use it as per your conveniency.&#xD;
13
+ This will also provide layout options for the dropdown. You can change it easily.</description>
14
+ <notes>Solwin custom google translate extension for translation your whole website easily.</notes>
15
+ <authors><author><name>Sanjay Dabhoya</name><user>solwin</user><email>stdabhoya@yahoo.com</email></author></authors>
16
+ <date>2015-07-28</date>
17
+ <time>11:59:09</time>
18
+ <contents><target name="mageetc"><dir name="modules"><file name="Solwin_GoogleLangTranslator.xml" hash="9054039feb3418f641e6f004657addba"/></dir></target><target name="magecommunity"><dir name="Solwin"><dir name="GoogleLangTranslator"><dir name="Block"><file name="Index.php" hash="3d05e8195ac5877ac630b1d818fd861b"/></dir><dir name="controllers"><file name="IndexController.php" hash="48fad545ae7217ef09a621f93e18f312"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2a35b8c2e005073557ceeae3c904c2cd"/><file name="config.xml" hash="f5adea5abc16588add3d323287058b87"/><file name="system.xml" hash="0017cbc3003f2afe26f13040d7830a0e"/></dir><dir name="Helper"><file name="Data.php" hash="33b657b01dd9504df58540e8153e0714"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Language.php" hash="61da3764bcb6d11082d397a4ad797b97"/><file name="Layout.php" hash="2a5fb81924d847deb8e473cbcc6a008e"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="googlelangtranslator"><file name="index.phtml" hash="5747a2b79dcbcab77942e25507735fa0"/></dir></dir><dir name="layout"><file name="googlelangtranslator.xml" hash="e2391ad3cd559cae0191d188f97a3479"/></dir></dir></dir></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
21
+ </package>