Localizing a Drupal 7 Commerce site a step by step guide
This is going to be a step by step guide for localizing & translating a Drupal 7 commerce site. there are many ways and tools Drupal and its contributed modules support and this is just one of them.
I will not go into too much explanations but will try and make sure I cover all the steps needed to translate a Drupal commerce site.
Note: commerce kickstart 2 comes with some of this but last time I checked it did not provide full localization and translations features.
1) Download the following modules
2) Enable the modules
- Entity Translation
For the i18n we will enable the following modules:
- String translation
- Field translation
- Translation sets
If you are using drush here is a quick script you can run
1) Make sure your regional settings are correct
go to admin/config/regional/settings
set Default country & Default time zone
2) Set up your languages
go to admin/config/regional/language
And add your languages, note that the Default language should correspond to the main language on your site and that includes the development of the site if you name your fields in English and your default language is French Drupal will think that the labels for those fields are in French.
3) Configure language detection
Go to admin/config/regional/language/configure
enable URL (or your preferred method)
4) Import language files
Download Drupal core translations
Download Drupal Commerce translations
Import the files you downloaded by going to admin/config/regional/translate/import and selecting a coresponding file and a language.
5) provide a Language selector for site visitors:
Go to the blocks section admin/structure/block and position the block "Language switcher (User interface text)" in one of the regions.
Configure content translation
1) Enable Content types for localization
Go to admin/config/regional/entity_translation
In the Translatable entity types section select the following
- Taxonomy term
2) Enable Multilingual support for each of your node types
start by visiting all your node types (this should include the product display) and on the edit tab:
Under publishing options set Multilingual support to Enabled, with field translation
go to manage fields and do the following:
- Press "replace" next to the title this will convert the title into a translatable field
- Edit each field you want to translate and set it to Enable translation
3) Enable Multilingual support for each of your product types
visit admin/commerce/products/types and edit each of the product types
Set set Multilingual support to Enabled, with field translation
go to manage fields and follow the same instructions as the node types above.
4) Enable Multilingual support for Taxonomies
Visit the manage fields for each of the Taxonomies/vocabularies you want to localize and
Use the "Replace" link next to the Title and Description to convert those into translatable fields.
5) Set some sensible defaults
Go back to admin/config/regional/entity_translation and you will see a tab for each of the content types you enabled and their associated bundles (sub types).
Visit each one and set its Default language
You can set "Hide shared elements on translation forms" to stop translators from accidentally changing non translatable fields.
you can now start translating content this will be divided into four tasks:
1) Translate the Built in interface
visit the translate interface (admin/config/regional/translate/translate) and search for the strings you wish to translate
2) Translate content
visit each of the nodes, products or taxonomy terms and
- Edit to make sure a language is selected
- click the Translate tab and add translations to each of the languages.
3) Translate field properties
This useful for most commerce product use cases. if you have added any Attribute fields using a list text you can translate their values as follows:
- Go to the Managed fields of you product
- Edit each of the Attribute fields (those are once that have Enable this field to function as an attribute field on Add to Cart forms)
- Click the Translate tab
- Add translations to each of your languages
- Under field settings you will be able to translate each of the terms.
Note: The above method can also be used to translate the labels of fields but you can also use the standard translate interface (admin/config/regional/translate/translate) to do this.
4) Menu translation
- Edit your menu
- Under Multilingual options, Translation mode set the option "Translate and Localize. Menu items with language will allow translations. Menu items without language will be localized."
This will make the menu translatable and you can simply edit each of the items and use the "Translate" tab to add translations, don't change the Language of the item unless you want Language specific menu links. Optionally you can use the standard translate interface to translate menu items.
Note that nodes linked to a menu should use the node edit/translate interface to provide language native names to the menu links.
- info [at] blue-bag.com
- Telephone: 0843 2894522
- Blue-Bag HQ:
The Garage, Manor Farm
Somerset, BA3 4HP, United Kingdom
- Telephone: (+44) 01761 411542
- Blue-Bag Brighton:
Unit 35 Level 6 North, New England House
New England Street, Brighton
BN1 4GH United Kingdom
- Telephone: (+44) 07944 938204
- VAT GB 748125034
- UK Company Reg: 3932829