Magento store languages: store views, language packs and translations
In Magento every language is a store view. Our Main Website already has English and German; in this lesson we add Turkish, install free language packs with Composer, set the locale per store view, and translate a product and the home page.
A store view per language
Website, store and store view: the website holds customers, prices and the timezone; the store holds the root category; the store view holds the language. One website can have many store views, one per language, that share the catalog and the cart.
| Veld | Our value | Opmerking |
|---|---|---|
| Store | Main Website Store | The store whose catalog the new language shows. |
| Naam | Türkçe | Customers see this name in the language switcher, so write it in its own language. |
| Code | tr | Lowercase letters, numbers and underscores. It is used in URLs and on the command line. |
| Status | Enabled | |
| Sort Order | 0 | Volgorde in de taalschakelaar. |
Admin: Stores › All Stores › Create Store View, daarna Save Store View and confirm the dialog.
Locale Options per store view
Stores › Configuration › General › Locale Options with the scope switcher on the store view. Two things to know:
- In production mode the Locale field is locked in the admin. The locale is set on the command line (
config:set), together with the static files for that locale. - Timezone has no store view scope: it is a website setting, and all store views of one website share it.
Language packs with Composer
Magento’s own magento/language-* packages contain only a language.xml, no translations. The texts come from community packs. The two we installed and tested on Magento 2.4.9 with PHP 8.5:
| Pakket | Versie | Uitgebracht | Licentie |
|---|---|---|---|
splendidinternet/mage2-locale-de-de (Splendid Internet) | 1.74.3 | 17 November 2026 | OSL-3.0 |
hidonet/magento2-language-tr_tr (Hidonet) | 1.0.5 | 26 October 2026 | OSL-3.0 |
As the Magento file owner, in the Magento folder:
ls vendor/magento/language-de_de
bin/magento maintenance:enable
composer require splendidinternet/mage2-locale-de-de hidonet/magento2-language-tr_tr
for p in splendidinternet/mage2-locale-de-de hidonet/magento2-language-tr_tr; do composer show $p | grep -E '^(name|versions|released|license)'; done
Locale, static files and indexes
The store view tr gets tr_TR (German de got de_DE in Lesson 4):
bin/magento config:set --scope=stores --scope-code=tr general/locale/code tr_TR
Static files for every locale in use. In production mode a locale without deployed static files shows pages without styles:
bin/magento setup:static-content:deploy -f en_US en_GB de_DE tr_TR
A new store view needs its own index rows (products, prices, search):
bin/magento indexer:reindex
bin/magento maintenance:disable && bin/magento cache:flush
Then as root, because OPcache on our server does not check files for changes (Lesson 1):
systemctl reload php8.5-fpm
Product names per store view
Catalog › Products, open the product, switch Scope to the store view. Untick Use Default Value on each field you translate: here Product Name (MageBooster Seyahat Kupası) and, under Search Engine Optimization, URL Key (magebooster-seyahat-kupasi). Every untouched field keeps the default value. Category names, attribute labels and option labels work the same way.
A home page per store view
CMS pages are assigned to store views. Content › Pages › Add New Page: Page Title Ana Sayfa, Content Heading, URL Key ana-sayfa, and under Page in Websites only the Türkçe store view. Then Stores › Configuration › General › Web › Default Pages, scope Türkçe: CMS Home Page = Ana Sayfa. CMS blocks work the same way: one copy per language.
Saved settings invalidate the configuration cache:
bin/magento cache:flush
The language switcher
Luma shows the language switcher in the header as soon as a store has more than one store view. On our test store: English (Default Store View), German with menus and buttons from the German pack, and Türkçe with its own home page and the product under its Turkish name and URL.
| Option | Address | Waar |
|---|---|---|
| One domain, language in a cookie | https://www.example.com/ | Default (this lesson) |
| Storecode in de URL | https://www.example.com/tr/ | Web › Url Options › Add Store Code to Urls |
| One domain per language | https://www.example.com.tr/ | Lesson 11 (multisite) |
Downloads
#!/bin/bash # MageBooster Lesson 16: store languages in Magento 2.4.9. Run the parts one by one on the server. # First create the store view in the admin: Stores > All Stores > Create Store View (here: Türkçe, code tr). # 1) As the Magento file owner, in the Magento folder (production mode) cd /var/www/magento ls vendor/magento/language-de_de # Magento's own language package: no CSV inside bin/magento maintenance:enable composer require splendidinternet/mage2-locale-de-de hidonet/magento2-language-tr_tr for p in splendidinternet/mage2-locale-de-de hidonet/magento2-language-tr_tr; do composer show $p | grep -E '^(name|versions|released|license)'; done # 2) The language of the store view "tr" (German "de" got de_DE in Lesson 4) bin/magento config:set --scope=stores --scope-code=tr general/locale/code tr_TR # 3) Static files for every locale your store views and admin users use, then the indexes bin/magento setup:static-content:deploy -f en_US en_GB de_DE tr_TR bin/magento indexer:reindex bin/magento maintenance:disable && bin/magento cache:flush # 4) As root: OPcache without timestamp checks needs a PHP-FPM reload (your PHP version) systemctl reload php8.5-fpm # 5) After the admin changes (product name, CMS page, Default Pages), as the Magento file owner bin/magento cache:flush
#!/bin/bash # MageBooster Lesson 16: store view settings from the command line. Use your own store view codes. cd /var/www/magento sudo -u magento bin/magento config:show --scope=stores --scope-code=tr general/locale/code sudo -u magento bin/magento config:set --scope=stores --scope-code=de general/locale/code de_DE sudo -u magento bin/magento config:set --scope=stores --scope-code=tr general/locale/code tr_TR # the language in the address: https://your-domain/tr/ (all store views) sudo -u magento bin/magento config:set web/url/use_store 1 sudo -u magento bin/magento cache:flush
Problemen oplossen
| Symptoom | Oorzaak en oplossing |
|---|---|
| The new store view shows pages without styles | Production mode: its locale has no static files. Run setup:static-content:deploy with that locale, flush the cache. |
| Buttons stay in English after the install | The store view locale is still en_US (config:show --scope=stores --scope-code=...), or the cache was not flushed / PHP-FPM not reloaded. |
| The Locale field is greyed out | Production mode locks it. Use bin/magento config:set --scope=stores. |
| No products or empty search in the new store view | Voer bin/magento indexer:reindex after creating the store view. |
| No language switcher on the storefront | The store needs at least two active store views; one domain per language (Lesson 11) hides it. |
| A word in the pack is wrong | Override it in your theme: app/design/frontend/Vendor/theme/i18n/tr_TR.csv, then deploy static files. |
Volgende les
Lesson 17: Locale and currencies: euro, pound and Turkish lira.
▶ Bekijk alle MageBooster-lessen op YouTube: alle lessen op volgorde · abonneer je op het kanaal
