Own Magento translations file

02.12.2013 Angelika Siczek

 

As to translate particular phrases, these must be saved in files which contains a form of proper string:

 

1
< ?php echo $this->__(‘our phrase’;) ?>

 

As to translate above string, it is necessary to made create easy module. As to make it in app/code local cataloque, we have to create proper cataloques for created module which in another word means to create the cataloque with developer name as for example Global4Net + module name – Translations. In this cataloque we create etc file where we put config.xml file. Finally- our computer way will look as app/code/local/Global4net/Translations/etc/config.xml. In created file we put the following code : 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" <span class="x653mz7oi" id="x653mz7oi_5">encoding</span>="utf-8"?>
 
<config>
 
    <modules>
 
        <Global4net_Translations>
 
            <version>1.0.0</version>
 
        </Global4net_Translations>
 
    </modules>
 
    <frontend>
 
        <translate>
 
            <modules>
 
                <Global4net_Translations>
 
                    <files>
 
                        <default>Global4net_Translations.csv</default>
 
                    </files>
 
                </Global4net_Translations>
 
            </modules>
 
        </translate>
 
    </frontend>
 
    <adminhtml>
 
        <translate>
 
            <modules>
 
                <Global4net_Translations>
 
                    <files>
 
                        <default>Global4net_Translations.csv</default>
 
                    </files>
 
                </Global4net_Translations>
 
            </modules>
 
        </translate>
 
    </adminhtml>
 
</config>

 

Another step is to create csv file where translations will be located. In app/locale/pl_PL cataloque which is responsible for polish language, we create the file with full developer name and the module which in our case would be Global4Net_Translations.csv 

Translations location may be overlooked in anither files so in every part we contain :

“Translation name”, “Translated name”

 

Hence, after putting on Enter we add another translations. As our translations be switched on, there is a necessity of adding one more file which is responsible for opening module’s functioning. That’s why, in app/etc/modules cataloque, we create xml file which is called just as developers and module name – Global4Neet_translations.xml . Code must be located in the code which will switch of Our Magento module :

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0"?>
 
<<span class="x653mz7oi" id="x653mz7oi_6">config</span>>
 
    <modules>
 
        <Global4net_Translations>
 
            <active>true</active>
 
            <codePool>local</codePool>
 
        </Global4net_Translations>
 
    </modules>
 
</config>

 

  

In case of we were interested in turning off the module, all need to be done is to change true on false. Now we can use our own translations file.

Have a question?

Write to us

    PDF, DOC, DOCX, JPG lub PNG (max 5MB)

    *Required

    Andrzej-kurs-programowania

    Andrzej Szylar

    Chief Executive Officer

    E-mail:

    andrzej.szylar@unitygroup.com
    Magda2

    Magdalena Paczyńska-Kamienik

    HR Manager

    E-mail:

    magdalena.paczynska@unitygroup.com
    Aleksandra

    Aleksandra Bielawska-Clegg

    HR Business Partner

    E-mail:

    Michal

    Michał Duława

    New Business Developer

    E-mail:

    Katarzyna

    Katarzyna Zajchowska

    Marketing Partner

    E-mail: