Getting started with multilingual content in Drupal 8
Today I re-installed my copy of Drupal 8 that I use for testing and I must say...
wow, there is so much good stuff in here. I resisted upgrading to Drupal 7 with my projects when it first came out and for good reason... many modules that are necessary for my job were not ready when the core module was. I understand this was an improvement over previous upgrades but with Drupal 8 I'm going to be ready to dive in the first day that Drupal 8 is released.* This is awesome.*
Getting Started
Working with Core Dev First, you're going to need a recent version of PHP. For this reason, I had to use my laptop as a host because my development server uses an older version and I'm not ready to stop production for a beta test. Once you have a suitable environment ready we can proceed with installation.
Click the "version control" link
Check that the 8.x branch is selected. If it is, scroll down, then copy the clone command to your terminal
Drupal will now be pulled from the git repository When the download is complete, visit that site on your webserver. You will now begin the standard Drupal install process. But wait! We have a few extra things to note...
I browse in French, so it asked me to install in French!
I had to create both
files
andfiles/translations
insites/defualt
and give them both appropriate permissions (777?)Copy default.settings.php in your
sites/default
folder to settings.php ... permission it the same way as abovePut in your database settings. I picked "minimal" configuration, as I always do. As I was doing these steps Drupal fetched the French translations for me and did most of the installation in French.
Drupal, you are so awesome.
Post-Install Configuration
I do a few things to get setup in my new dev/beta environment because I picked the "minimal" installer.
- Switch to Bartik theme
- Enable "color" module and change Bartik's blue to something nicer
- Enable "toolbar" module so you don't have to click around all over the place
- Create a "page" content type
- Enable "field ui" module
Multilingual Config
- Enable the "content translation" module (the other multilingual modules, "interface translation" and "language" were already enabled for me)
- Go to Configuration > Regional and Language > Content language settings and enable "content" (thanks Gábor for pointing this out). You can also enable which fields get translated on this page but you may need to enable the content type translation (see next two steps) first.
- Edit the "page" content type, enable translation on the type
- Go to "manage fields" for the "page" content type, edit the "body" field, go to the "field settings" tab, enable translation of the field (you must have >1 fields enabled for translation or your page will just redirect to the "manage fields" page
- Now go edit some content! You will first need to create a node, and then click the translate tab to add a translation
- You will need a language switcher. I found this hard to figure out at first, but then I realized that most blocks don't exist by default, so if you go to Structure > Add blocks you will be presented with a list of blocks you can create, one of which is a language switcher for content Now you should be able to create content and switch between the languages. It seems that if a field is blank in one language, it will be sourced from a different language where that content is available.
What Needs Work (Jan 18 2013) So far I have only noticed a few issues (Jan 18 2013)...
- The title field is not (yet) translatable
- If fields aren't translatable on a node type, you get redirected to the "manage fields" page but no message to tell you why you are there
- Not knowing how to add a language switcher block was a bit confusing
- The "check for updates now" link is really low profile, I tried to add additional languages but they all have only 7.x branches of the translation files so this link did not work unfortunately
- The new toolbar does not have icons for the translated versions of the items. Not sure why these little pictures need to be translated/translatable! Overall these are very minor concerns that anyone who is familiar with Drupal should be able to overcome easily. Especially if you have been doing entity translation in Drupal 7. You'll probably note that the old method of having duplicate nodes of each piece of content, one node per language, is officially gone. This is not a possible way to translate in Drupal 8. Good.
How to Help
Drupal.org is the best place to look for information on how to contribute but I'll try to make a quick summary of the types of places you can contribute.
- First, look at the issue queue for Drupal 8 issues on the Drupal.org project page for Drupal noted at the start of this article. Read over the issues and comment on them if you can summarize and/or offer feedback on the progress that is being made.
- Once you are aware of the issues, and you have done some testing on your own, create new issues for items that should be done prior to release. I will be looking at the items I mentioned above as my next steps.
- Create patches for issues where you are able to fix the code. Since you used git to get the latest version at the start, you can just run git to create your patch:
git diff >ddo-issue-number-comment-number.patch
... then take that patch over to the relevant issue and post it to drupal.org! - Once you're comfortable with creating patches, you can also test some patches! They are a bit harder to manage sometimes, as you may need to look at the path contained in the patch file. In general, you can probably go to the drupal root and run
patch < patchfile.patch
. Cross your fingers and hope for no rejects. Then test it and provide feedback on the issue. - Join an IRC channel. If you are at a code sprint, this is how we share links during discussion. At other times, IRC is a good substitute when you need to ask a question but you're developing on your own. Finally, after you've done a few of these things, you're going to come back to the site in a day or two and...
throw the whole thing in the garbage. I wish I were joking. Since Drupal 8 is still in development at the time of this writing, major changes can happen that break your config. So often, you will simply want to wipe out your dev site and start over rather than face bugs that are undocumented and temporary. Best to start with the latest, each time you start... unless you're reading every commit message and doing a git diff to see what happened.
Following the Initiatives
There are many "core initiatives" which are focused areas of work on Drupal 8. I have been most involved in Drupal 8 Multilingual... or D8MI. If you search D8MI as a tag on the Drupal project page, you will see what work is to be done. This is possible because the D8MI volunteers have tagged the issues and
Gábor Hojtsy, the initiative leader, does an excellent job of keeping us organized. You can also check out the individual sites for each initiative to see what issues need the most work. Joining the initiative on groups.drupal.org is a good way to stay informed, and each group also hosts IRC meetings on a regular basis. Drupal 8 Core Initiatives list Drupal 8 Multilingual homepage (see "focus" page for top priorities)