This module provides a GUI to change the language fallback system. This will allow you to setup language hierarchies where translations of a site's content, settings and interface can fall back to parent language translations, without ever falling back to English.
hook_language_fallback_candidates_alter(), without which translations from any available language are used as fallbacks, which is usually unexpected.
In this example, we assume Drupal's default language is English and that you're using Entity Translation module to handle content translation.
- Enable language detection based on URL at /admin/config/regional/language/configure.
- Goto /admin/config/regional/language and:
Create Spanish language, with code 'es'.
Create Spanish (Mexico) language, with code 'es-MX'.
Create Spanish (Spain) language, with code 'es-ES'.
- Order the languages to:
-- Spanish (Mexico)
-- Spanish (Spain)
- If you have a default Drupal install, go to /admin/structure/types/manage/page and in the
Publishing options tab select 'Enabled, with field translation' under 'Multilingual support'.
- Go to the body field edit page at /admin/structure/types/manage/page/fields/body and
select 'Enable translations'.
- Add some page content in English, then click the translate tab and add in a Spanish translation.
- If the node created was node 10, then you should see the following;
/node/10 - English content
/es/node/10 - Spanish content
/es-ES/node/10 - There is no Spain-specific content, so it will display the Spanish content.
/es-MX/node/10 - There is no Mexico-specific content, so it will display the Spanish content.
Systems covered by this project:
- Core's content/node translation system as well as field/entity translations (with submodules that add extra functionality, e.g. to translation overview pages)
- Interface & any i18n string translations (e.g. views, fields, field groups, taxonomies, panels, etc)
- Listings in views
- System settings (variables/configuration)
- URL aliases
- XML sitemap links
- Hreflang annotations
- And more!
Sometimes it's appropriate to apply the language hierarchy to content, but nothing else. Other times everything on a site should go through the same fallbacks. So this module puts the site builder in control by providing a number of submodules within Language Hierarchy that can be optionally enabled to apply fallbacks to each system that is required to have them (see the above list for what's supported). On Drupal's Modules page, they are all grouped under the 'Language Hierarchy' section.
Drupal 8 version
- Language fallback:
Another approach to providing language fallback functionality, with different features such as country-specific fallback chains and user geolocation integration, though that is incompatible with page caching. Does not cover menus, site maps, variables, and lacks some other features of Language Hierarchy. See this issue for full comparison & discussion.
- Sublanguage for Drupal 8 (sandbox):
A start on fallback functionality for D8
- Translation Clone:
Sometimes it's appropriate to duplicate a language from an original language, including all its translations (i.e. for content, interface & configuration), rather than just using the 'fallback' approach.
- Translation fallback:
Rather than providing fallback from one language to another, instead provides fallbacks for i18n string translations to the general interface translation rather than being specific to each textgroup/context. This functionality can be used with Language Hierarchy via the patch in this issue.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Content, Multilingual
- Reported installs: 195 sites currently report using this module. View usage statistics.
- Downloads: 3,415
- Automated tests: Enabled
- Last modified: November 6, 2016
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.