Community Documentation

Translating user defined strings

Last updated November 5, 2012. Created by Jose Reyero on September 25, 2008.
Edited by frederickjh, jvandyk. Log in to edit this page.

The String Translation module (i18nstrings.module, part of the i18n project) allows translation of user-defined strings. This is an API module (that is, it doesn't do anything by itself) that must be enabled only when required by other modules in the i18n package.

Module developers: See how this can be used in other modules without introducing new dependencies: Notifications.

The string translation UI is integrated into the localization system. All strings will be translatable through the Administer > Site building > Translate interface

You must decide on the site default language before using this feature. Changing it later will garble all your user defined strings translations. Read below!

About Drupal Strings

The Drupal localization system allows translation of hardcoded strings, using locale module and .po files. However, user-defined strings (menu items, taxonomy terms, field names, etc.) are not translatable using Drupal 6 core. This is why the Internationalization package includes its own string translation layer, which keeps track and allows translation of most user-defined strings.

String Translation

This module collects and keeps up-to-date user-defined strings so they can be translated using the standard translation page provided by Locale module: Administer > Site building > Translate interface

There are some key differences between standard localization and string translation:

  • The source strings to be translated must be defined first using the site's default language, which is not necessarily English
  • It uses Text groups to group strings. When using the Translate Interface screen at admin/build/translate/search you'll see different (searchable) groups under the "Limit search to:" heading: Taxonomy, Profile, Menus, etc.


The searchable text groups are provided by the i18n package.

About the site default language

When translating user-defined strings, the source string is stored using the site default language instead of English. If the default is other than English you will be able to import/export English translations too using the localization interface.
Warning: Whenever you change the default language, you'll need to manually recreate all the source strings so they are defined in that language. This means you may need to edit all your menu items, (localizable) taxonomy terms, etc.. The translations for other languages will be kept though.
Thus you need to decide your default language early on, when setting up your site. Changing the default language back and forth is unsupported and strongly discouraged.

References:
http://groups.drupal.org/node/15177
http://drupal.org/node/314035

AttachmentSize
Translation interface with textgroups support41.75 KB
textgroupsui.png60.83 KB

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x
Keywords
i18n, Internationalization, multilingual, string translation
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here