Translations - Drupal 5
by Konstantin Käfer
Drupal 5.x provides translation of the entire user interface out of the box. To distribute translations, Portable Object (.po) files are used.These files can be generated using GNU gettext (http://www.gnu.org/software/gettext/), an open source message translation framework. Currently, there are about 2400 strings in Drupal.
Obtaining translations
On Drupal's translation page (http://drupal.org/project/Translations), you can currently find more than 40 translations of Drupal. Pick your language, check what Drupal version you’re using and click on the “Download” link in that row. Note that not all translators are always keeping up with the most recent
Drupal release. It may take them some weeks or months to finish a translation for a new version of Drupal.
After downloading, extract the file. You will end up with at least these files:
| <langcode>.po – This is the actual translation and contains all translated strings (e.g. de.po, fr.po, ru.po). |
| installer.po – This file contains only the files required |
Note that there is no guarantee that a fully translated package is available for your language. Most “major” languages are fairly complete, but there are also exceptions. Similarly, a less common language may be at a 100% of completion. That is because translators are not a company with a dedicated localization team but a group of volunteers who are doing translation work on an entirely voluntary basis. It also depends upon you to help translation Drupal in your language.
After copying Drupal to your servers, don’t yet visit the URL in your browser. Copy install.po in your install profile’s folder (if you run the default installation, that’s profiles/default) and rename it to <langcode>.po.
When you point your browser to your Drupal installation, you should get a language selection screen. Select your language and click on next. As long as the installer has been translated to that language, it should now be in the selected language.
Unfortunately, it is not possible to automatically import the full translation during the installation process. Installing Drupal in another language currently has the only benefit of translating the preconfigured content types to the install language.
Even if you installed Drupal in a foreign language, it will still be in English by default. To enable another language, go to the module administration screen (at Administer » Site building » Modules) and enable the “Locale” module. Then, go to Administer » Site configuration » Localization and click on “Import” if you want to import a translation. Choose the <langcode>.po file from the zip file you downloaded, select the appropriate language and click on “Import”. Note that this can take a while.
If you want to start a translation from scratch (not recommended!), click on “Add Language” and provide details about that language. On the “Manage strings” tab, you can now start searching for untranslated strings and translate them.
To enable another language, go to the “Manage languages” tab, check the “Enabled” checkbox of your language, maybe set it to “Default” and save.
As previously mentioned, translations are created by the community for the community. Therefore, your help is greatly appreciated. If you want to help with an existing language, read their readme files (in the translation zip file) or look at further information on the project page on drupal.org.
To get started translating, see the Translator s guide (http://drupal.org/translators). Every group has a slightly different translation process, but basically they work with a lot of small .po files. You can obtain the single small files (usually one for each module) through CVS. Go to http://cvs.drupal.org/viewvc.py/drupal/contributions/translations/ and pick your language. Make sure that you have selected the right Drupal version in the “Sticky Tag” dropdown menu. With a program like poEdit (http://www.poedit.net/), you can create a .po file from a template and translate it, or open an existing file and complete or modify the translations.
To create translation templates (the files actual translations are based on) for custom modules, use the potx module. Install it and go to Administer » Site configuration » Translations and click on the “Extract strings” tab. You can now select the modules you want to generate templates for and export them.
By convention, translation templates and actual translations for a contributed module reside in a subdirectory named “po” in the module’s folder. Before translating a contributed module, check there if someone already went through the effort to translate it. In those “po” directories, the files are named according to the <langcode>.po scheme.
The processes for importing a translation for a contributed module is similar to importing a translation. Instead of creating a new language on the “Import” tab, select an existing language
