You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/m1x/magefordev/mage-for-dev-1.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -390,7 +390,7 @@ <h2>Layouts</h2>
390
390
</catalog_category_default>
391
391
</pre>
392
392
393
-
<p>It's saying in the catalog Module, in the category Controller, and the default Action, insert the the catalog/navigation Block into the "left" structure Block, using the catalog/navigation/left.phtml template.</p>
393
+
<p>It's saying in the catalog Module, in the category Controller, and the default Action, insert the catalog/navigation Block into the "left" structure Block, using the catalog/navigation/left.phtml template.</p>
394
394
395
395
<p>One last important thing about Blocks. You'll often see code in templates that looks like this:<br/>
Copy file name to clipboardExpand all lines: guides/m1x/magefordev/mage-for-dev-2.html
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ <h2>Setting up a Module Directory Structure</h2>
71
71
72
72
<pre>app/code/local/Packagename</pre>
73
73
74
-
<p>"Packagename" should be a unique string to Namespace/Package your code. It's an unofficial convention that this should be the name of your company. The idea is to pick a string that no one else if the world could possibly be using.</p>
74
+
<p>"Packagename" should be a unique string to Namespace/Package your code. It's an unofficial convention that this should be the name of your company. The idea is to pick a string that no one else in the world could possibly be using.</p>
75
75
76
76
<pre>app/code/local/Microsoft</pre>
77
77
@@ -240,4 +240,4 @@ <h2>Why Do I Care?</h2>
240
240
<li>Instantiate the class found in #4 (Mage_Sales_Helper_Data)</li>
241
241
</ol>
242
242
243
-
<p>While this seems like a lot of work (and it is), the key advantage is by always looking to the config file for class names, we can override core Magento functionality <strong>without</strong> changing or adding to the core code. This level of meta programming, not usually found in PHP, allows you to cleanly extend only the parts of the system you need to.</p>
243
+
<p>While this seems like a lot of work (and it is), the key advantage is by always looking to the config file for class names, we can override core Magento functionality <strong>without</strong> changing or adding to the core code. This level of meta programming, not usually found in PHP, allows you to cleanly extend only the parts of the system you need to.</p>
This topic describes how default strings can be changed in your custom theme using <ahref="{{site.gdeurl}}frontend-dev-guide/translations/xlate.html#translate_terms">translation dictionaries</a>. It also gives a short overview of the order in which translations are searched and applied by the Magento application.
14
+
15
+
<h2>How Magento applies locales</h2>
16
+
17
+
When the locale is changed for a store, Magento searches for translations in the corresponding dictionaries in the following locations:
If there are different translations for one string, the theme dictionary translations have priority over the module translations, and child theme translations have priority over parent theme translations.
27
+
28
+
<h2>Creating a theme dictionary to override parent strings for default locale</h2>
29
+
30
+
The translations priority described earlier is applied for the default en_US locale as well. So you can use the `en_US.csv` dictionary to customize the strings used in the default locale.
31
+
32
+
<spanid="luma_example">For example, this approach is used in the Magento Luma theme. It has the
33
+
<ahref="{{site.mage2000url}}app/design/frontend/Magento/luma/i18n/en_US.csv"><code>app/design/frontend/Magento/luma/i18n/en_US.csv</code></a> file, where the left column contains the default values (keys), and the right columns contains the values to be used instead when the Luma theme is applied:
34
+
</span>
35
+
36
+
"Add to Wish List", "Wish List"
37
+
"Add to Compare", "Compare"
38
+
"Your Checkout Progress", "Checkout Progress"
39
+
"Card Verification Number", "CVV"
40
+
...
41
+
42
+
It is important to remember that if you generate a dictionary for your theme using the <ahref="{{site.gdeurl}}config-guide/cli/config-cli-subcommands-i18n.html#config-cli-subcommands-xlate-dict">i18n tool</a> with the conventional names and locations for the dictionary, the existing dictionary gets overwritten.
43
+
44
+
That is why the recommended flow for adding custom strings is the following:
45
+
46
+
1. <ahref="{{site.gdeurl}}config-guide/cli/config-cli-subcommands-i18n.html#config-cli-subcommands-xlate-dict">Generate the dictionary</a> for your theme.
47
+
2. Change the necessary values in the right column, or add rows if the strings you want to replace are not in the dictionary. The i18n tool does not create a dictionary, if the theme files do not contain any strings for translation. In this case, add the file manually.
48
+
49
+
See the <ahref="{{site.gdeurl}}frontend-dev-guide/translations/translate_practice.html">Create a translation dictionary for a theme</a> topic for the practical illustration of the procedure.
50
+
51
+
52
+
53
+
<h3>Custom strings and dictionaries for not default locales</h3>
54
+
Even if your theme uses `en_US.csv` to override certain default strings, the dictionaries for other locales for your theme should contain the default strings as keys, not the custom ones.
55
+
56
+
Continuing the <ahref="#luma_example">previous example</a> with the Luma theme, if the `de_DE.csv` dictionary will be added for the Luma theme, it will look like following:
57
+
58
+
"Add to Wish List", <translation>
59
+
"Add to Compare", <translation>
60
+
"Your Checkout Progress", <translation>
61
+
"Card Verification Number", <translation>
62
+
...
63
+
64
+
The default values (keys) are used in the left column.
0 commit comments