i18n and l10n
Front-Commerce is built with internationalization (i18n) in mind. This guide details the steps to take when using Front-Commerce with Magento2 to build a fully localized store.
Each Front-Commerce store has one language (see Configure stores and Configure multiple stores). Each one of these languages use translations as detailed in the Translate your application page.
Where should a message be translated?
It is important to understand where a message comes from in order to know where it should be translated. In a micro-service architecture, information may come from a wide range of data source and Front-Commerce is sometimes only forwarding a message from your remote services.
Front-Commerce messages
Terms defined in a component are translated in Front-Commerce directly. Please refer to Translate your application to learn more about it.
Magento2 dynamic content
Dynamic content managed by administrators such as product descriptions, CMS pages, etc. can be found in the Magento admin area. On a product edition page for instance, you will have to edit the description in the context of the store view used by Front-Commerce (see below).
You can find more information in Magento's documentation: Translating Products and Translating Content.
Magento2 emails
Email content can be customized and translated as any other Magento emails, read more about it on Magento DevDocs.
Magento2 messages
Sometimes Front-Commerce forwards messages from Magento responses to API calls. A common situation where it happens is for error messages for instance (e.g: "The requested qty is not available" when adding a product to the cart).
In this case, Front-Commerce has no way to understand what the error is and only returns the message received.
Our roadmap contains an item to make it easier to support translations of these errors in Front-Commerce. If you are interested in this feature, learn more and give us your feedback on the related issue: #218.
Such messages can be translated using Magento translations mechanisms. Read more about how it works on Magento DevDocs.
Hopefully, you could start by installing a language pack and configure Magento so it matches your locale. See below for further information!
Install a language pack
By default, Magento2 do not contain translations as part of its core and is only
suited for the en_US
locale.
That being said, a Magento Localization organization has been created as part of Magento Community Engineering program to centralize translation efforts and language packs distribution.
We recommend installing language packs from there, and contribute to the translation efforts using the Crowdin platform if you find untranslated terms or incorrect translations.
For instance, to install translations for the fr_FR
locale you would have to
run composer require community-engineering/language-fr_fr
in your Magento
project.
Store configuration
You will then have to ensure that the store code in
your src/config/stores.js
configuration
matches the
Magento store view code
configured for the targeted language.
As per
Magento user documentation for adding a language,
you should ensure that the Locale configured in
Stores > Settings > Configuration > General > Locale Options
is the same than
in the Front-Commerce configuration above.