Localization
Overview
Since release 1.1.13, an i18n/en_US.csv
dictionary file has been distributed as part of the default Hyvä theme. It contains all strings that are part of Hyvä but not part of a native Magento installation.
The purpose of the "English-to-English" translation file is to serve as a base for custom translations into other languages.
Hyvä can be localized like any other Magento theme, that is, by adding a CSV translation dictionary in an i18n/
sub-folder of your theme.
Alternatively, if you want to keep your custom phrases separate from the core Magento and Hyvä translations, you can also put your custom translation files in app/i18n/{projectname}/{locale}/
. You'll also need a registration.php
and language.xml
and one or more CSV files. This core Magento feature can be considered a local language pack specific to a project.
(Thanks to Pieter Hoste from Baldwin for sharing this gem of knowledge.)
Using app/i18n/{projectname}/{locale}/
The registration.php
file looks like this, where {project}
is a string like mysite
and {locale}
is a string like de_de
:
<?php
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, '{project}_{locale}', __DIR__);
The language.xml
looks like this, where {locale}
is a string like de_DE
and {project}
matches your project folder name:
<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
<code>{locale}</code>
<vendor>{project}</vendor>
<package>{locale}</package>
</language>
The full documentation can be found at experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/cli/localization#create-directories-and-files.
Hyvä Localization Modules
We offer pre-made localizations for several languages that can be installed as Magento extensions.
They can be installed via composer using the package name in this list:
- bg_BG (Bulgarian):
hyva-themes/i18n-bg-bg
- ca_ES (Catalan):
hyva-themes/i18n-ca-es
- de_CH (Swiss German):
hyva-themes/i18n-de-ch
- de_DE (German):
hyva-themes/i18n-de-de
- es_ES (Spanish):
hyva-themes/i18n-es-es
- fr_FR (French):
hyva-themes/i18n-fr-fr
- it_IT (Italian):
hyva-themes/i18n-it-it
- ko_KR (Korean):
hyva-themes/i18n-ko-kr
- nl_BE (Belgian):
hyva-themes/i18n-nl-be
- nl_DI (Dutch, informal):
hyva-themes/i18n-nl-di
- nl_NL (Dutch):
hyva-themes/i18n-nl-nl
- pl_PL (Polish):
hyva-themes/i18n-pl-pl
- pt_BR (Brazilian Portugese):
hyva-themes/i18n-pt-br
- uk_UA (Ukranian):
hyva-themes/i18n-uk-ua
Installation
To install a localization module, run the following commands, replacing the code in the package name with your desired locale.
For example, to install the Italian localization module, use:
Be sure to also install a default Magento language pack for the target locale, and to configure the desired language for the store view in the system configuration.