Up to date as of October 16th, 2015.
As we touched on in the detection options tidbit and when talking about language configuration, the site default language used to be a very key (and higly dangerous to change) setting, because all the things that were in an unspecified language were assumed to be in that language. In Drupal 8, one of our most important goals was to make everything know its language as far and wide as possible.
Extensible special languages
Not everything can have a language even if it has a language property. Drupal 7 has one special language, Language neutral for these cases. This "language" is assigned to content which is not specifically in a language. People also used this to designate when the language was not known but some language needed to be assigned later. In Drupal 8, these two roles are separated into "Not applicable" and "Not specified" respectively. Also, these two special languages are stored as configuration with the other administrator configured languages (but are not shown on the configuration page to avoid confusion). Modules and distributions can add more special languages like these easily. These are locked (cannot be edited or removed), and when shown in a language list, they show after the manually configurable languages.
Language assignment far and wide
Language assignment is now available far and wide. A simple example is Views. Each view knows which language it was created in. All the views shipped with Drupal core are in English, but they are adjusted to the site default language if you install in another language. You can also create views in any language configured on the site.
When you create a view, the module assumes you created it in the site default language. However, if you want to create views specifically for language sections of your website (such as for a geographic region specific promotion), you don't need to create it in a language that it will never be displayed in and then translate it. You can create it in the language needed, and the view will know its language. How?
When you edit the basic properties of a View, you can see language is now one of these properties. (You'll see later that this information and some more details let us translate shipepd Views in Drupal core as well as let you translate your Views regardless of source language. Details in future tidbits).
We even track the language of site settings like your site name and slogan. This does not have a user interface in core, we save the site name and slogan in the language used to install the site. So if you install in Catalan, Drupal will know your site name and slogan are in Catalan.
Content entities with bundles have even more flexibility
In Drupal 7 you have per content type settings for language features. You can go edit a content type, language enable it and that will make the language selector show up on creating new items or editing existing items of that type. Drupal 8 expands on this a great deal with importing many of the i18n module features around language configuration into core and expanding across all entity types and bundles.
Drupal 8 uses content entities for storing comments, users, taxonomy terms, nodes, menu items, even custom blocks that can have types. Now there is a central configuration screen to set up language for these. Initially on this screen you get a list of the entity types available, and you can choose which ones to customize to differ from the default behavior. The default behavior being each content entity is assumed to be in the site default language in effect at the time of the creation of the entity.
For each entity type, you can configure settings per bundle (such as content types for nodes or vocabularies for taxonomy terms). You have the option to show the language selector on the UI, which would let users change from the default selected option. It is also possible to initialize the default selected language to a dynamic language or a specific value. Dynamic possibilities include the site default language at the time of creation, the current interface language when the content is created or the user's preferred language who creates the entity.
This allows you to configure site users to automatically get the interface language when registering, or your forums to tie to one language if you only have a single language forum. Certain content types can have language selectors on a bundle level as needed. And best of all, all the settings are integrated on one screen providing you a good overview of your content language setup.
Issues to work on
- All the configured languages including the special ones will be available across everything in Drupal; content, configuration translation, etc. It would be great to have a system where some languages are not exposed in all environments. See https://drupal.org/node/1314250 for a discussion on such a system. Does not seem very likely for core unfortunately at this point. May need to be a contrib module that does massive form altering at different places based on configuration.
Menus are not showing on this screen yet. Why? Well, we are working on those. That should be in Drupal 8 core. See http://drupal.org/node/1945226
Languages are still stored in the database. We are working hard to make them use the configuration system so you can stage and push them with configuration changes (also translate language names). That is going in http://drupal.org/node/1754246, hopefully will also be possible to get into Drupal 8 still.
Great article series. Thanks!
Great article series. Thanks!
Add new comment