Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Apress.Pro.Drupal.7.Development.3rd.Edition.Dec.2010.pdf
Скачиваний:
54
Добавлен:
14.03.2016
Размер:
12.64 Mб
Скачать

CHAPTER 19 LOCALIZATION AND TRANSLATION

Figure 19-32. The source post has been edited, and the translated post is flagged as outdated.

A source node and translations of the source node have separate node numbers and, in fact, exist as completely separate nodes in the database. They are related to each other by the tnid column of the node table, which has as its value the node ID of the source node. Assuming that the English version is the source node and is the first node on the site and the French and Hebrew translations are the next two nodes added, the node table will look like Figure 19-33.

Figure 19-33. The tnid column tracks relationships between source nodes and their translations.

Notice that the 1 in the translate column indicates an outdated translation.

Localizationand Translation-Related Files

Sometimes, knowing which parts of Drupal are responsible for which localization or translation functions is difficult. Table 19-1 shows these files and their responsibilities.

447

CHAPTER 19 LOCALIZATION AND TRANSLATION

Table 19-1. Files Related to Localization and Translation Within Drupal

File

Responsibility

 

 

includes/bootstrap.inc

Runs the DRUPAL_BOOTSTRAP_LANGUAGE phase that

 

determines the current language

includes/language.inc

Included by bootstrap if multiple languages are

 

enabled; provides code for choosing a language

 

and rewriting internal URLs to be language-

 

specific

includes/common.inc

t() is found here, as is drupal_add_css(), which

 

supports right-to-left languages.

includes/locale.inc

Contains user interfaces and functions for

 

managing language translations

modules/locale/locale.module

Provides string replacement and translation

 

imports when modules or themes are installed

 

or enabled; adds language settings interface to

 

path, node, and node type forms

modules/translation/translation.module

Manages source nodes and translations thereof

modules/translation/translation.admin.inc

Provides the translation overview shown when

 

the Translate tab is clicked (see Figure 19-31)

 

 

Additional Resources

Internationalization support is very important to the Drupal project. To follow the progress of this effort or to get involved, see http://groups.drupal.org/i18n. Also check out the Translation Management module at http://drupal.org/project/translation_management.

448

CHAPTER 19 LOCALIZATION AND TRANSLATION

Summary

In this chapter, you’ve learned the following:

How the t() function works.

How to customize built-in Drupal strings.

How to export your customizations.

What portable object and portable object template files are.

How to download portable object template files and generate your own.

How to import an existing Drupal translation.

How to use style sheets for right-to-left language support.

How language negotiation settings affect Drupal.

How content translation works.

449

Download from Wow! eBook <www.wowebook.com>

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]