Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:documentation:devguide:core:translator [2016/10/04 09:05] carolina.santos [Exemplos] |
wiki:documentation:devguide:core:translator [2016/11/04 07:32] (current) carolina.santos [CMake] |
||
---|---|---|---|
Line 7: | Line 7: | ||
Translation dictionaries are sets of textual and binary files that are created through the [[https://www.gnu.org/software/gettext/ | GNU Gettext]] tools. | Translation dictionaries are sets of textual and binary files that are created through the [[https://www.gnu.org/software/gettext/ | GNU Gettext]] tools. | ||
- | The translation is not automatic, it is necessary to perform this process manually in the files "po". | + | The translation is not automatic, it is necessary to perform this process manually in the "po" files. |
===== API ===== | ===== API ===== | ||
Line 24: | Line 24: | ||
\brief This singleton is designed to deal with multi-language text translation in TerraLib. | \brief This singleton is designed to deal with multi-language text translation in TerraLib. | ||
*/ | */ | ||
- | class TECOREEXPORT Translator | + | class Translator |
{ | { | ||
Line 158: | Line 158: | ||
To facilitate the creation of binary files containing the translated messages as well as their inclusion in the binary distribution of packages in TerraLib family applications, the macro **TERRALIB_REGISTER_TRANSLATION** was created in CMake to be able to automate this process. This macro is in //build/cmake/terralib_macros.cmake// file in the code repository. | To facilitate the creation of binary files containing the translated messages as well as their inclusion in the binary distribution of packages in TerraLib family applications, the macro **TERRALIB_REGISTER_TRANSLATION** was created in CMake to be able to automate this process. This macro is in //build/cmake/terralib_macros.cmake// file in the code repository. | ||
- | All TerraLib libraries that need the message translation system should use the above macro in your build project files (//CMakeLists.txt//). It has the following form: | + | All TerraLib libraries that need the message translation system should use the above macro in their build project files (//CMakeLists.txt//), in the following form: |
<code cpp> | <code cpp> | ||
Line 212: | Line 212: | ||
**Note:** In xgettext command where you are upgrading the template file, you can enter new files if necessary. | **Note:** In xgettext command where you are upgrading the template file, you can enter new files if necessary. | ||
- | The creation of the binary files with the extension ".mo", containing translations to use in the systems is done automatically in the build through the macro **TERRALIB_REGISTER_TRANSLATION**. Add to your //CMakeLists.txt// the record of translations as shown below: | + | The creation of the binary files with the extension ".mo", containing translations to use in the systems, is done automatically in the build through the macro **TERRALIB_REGISTER_TRANSLATION**. Add to your //CMakeLists.txt// the record of translations as shown below: |
<code cpp> | <code cpp> | ||
Line 222: | Line 222: | ||
**Note:** use the same name as the library or executable in the record of your translation. | **Note:** use the same name as the library or executable in the record of your translation. | ||
- | In your source code includes a call to the macro **TE_ADD_TEXT_DOMAIN** to add at runtime your translation file. See the example below: | + | In your source code include a call to the macro **TE_ADD_TEXT_DOMAIN** to add at runtime your translation file. See the example below: |
<code cpp> | <code cpp> | ||
Line 275: | Line 275: | ||
- | ===== References ===== | + | ===== Additional References ===== |
* [[http://www.boost.org/doc/libs/1_56_0/libs/locale/doc/html/messages_formatting.html | Boost.Locale - Messages Formatting (Translation)]] | * [[http://www.boost.org/doc/libs/1_56_0/libs/locale/doc/html/messages_formatting.html | Boost.Locale - Messages Formatting (Translation)]] |