Translator.h File Reference

This class is designed for dealing with multi-language text translation in TerraLib. More...

#include "../BuildConfig.h"
#include "Config.h"

Go to the source code of this file.

Macros

Internationalization Defines

Flags for TerraLib code internationalization.

#define TERRALIB_TEXT_DOMAIN   "terralib"
 It contains the name of the text domain used in the translation of messages in TerraLib. More...
 
#define TERRALIB_TEXT_DOMAIN_DIR   "locale"
 It contains the translation catalog directory. More...
 
#define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset)   ((void)0)
 It adds the given text domain located at domain-dir with the given codeset to the multilingual system. More...
 
#define TE_GENERAL_TR(message, domain)   message
 Try to translate the message according to the given domain. See the TE_TR macro for more infomation on how to create a translation mark for your code. More...
 
#define TE_GENERAL_TR_PLURAL(domain, message1, message2, n)   (n > 1 ? message2 : message1)
 Try to translate the message according to the given domain and plural form. See the TE_TR_PLURAL macro for more infomation on how to create a translation mark for your code. More...
 
#define TE_TR(message)   TE_GENERAL_TR(message, TERRALIB_TEXT_DOMAIN)
 It marks a string in order to get translated. More...
 
#define TE_TR_PLURAL(message1, message2, n)   TE_GENERAL_TR_PLURAL(TERRALIB_TEXT_DOMAIN, message1, message2, n)
 It marks a string in order to get translated according to plural form. More...
 

Detailed Description

This class is designed for dealing with multi-language text translation in TerraLib.

Definition in file Translator.h.

Macro Definition Documentation

#define TE_ADD_TEXT_DOMAIN (   domain,
  domaindir,
  codeset 
)    ((void)0)

It adds the given text domain located at domain-dir with the given codeset to the multilingual system.

Note
This macro will check if the domain already exists before doing anyting.

Definition at line 309 of file Translator.h.

#define TE_GENERAL_TR (   message,
  domain 
)    message

Try to translate the message according to the given domain. See the TE_TR macro for more infomation on how to create a translation mark for your code.

Definition at line 320 of file Translator.h.

#define TE_GENERAL_TR_PLURAL (   domain,
  message1,
  message2,
 
)    (n > 1 ? message2 : message1)

Try to translate the message according to the given domain and plural form. See the TE_TR_PLURAL macro for more infomation on how to create a translation mark for your code.

Definition at line 331 of file Translator.h.

#define TE_TR_PLURAL (   message1,
  message2,
 
)    TE_GENERAL_TR_PLURAL(TERRALIB_TEXT_DOMAIN, message1, message2, n)

It marks a string in order to get translated according to plural form.

Example of usage:

1 int n = f(...);
2 
3 std::cout << TE_TR_PLURAL("One Message!", "Two Messages", n);
4 
5 throw Exception(TE_TR_PLURAL("One Message!", "Two Messages", n));

In the above example, the parameter n can be a threshold that helps to choose between the first or the second construction. If your trabslation file is configured with a theashold of 1, indicating that if n > 1 must choose the second construction, the plural versin will be choosed, otherwise, it will choose the singular form (the fisrt one).

Definition at line 369 of file Translator.h.

#define TERRALIB_TEXT_DOMAIN   "terralib"

It contains the name of the text domain used in the translation of messages in TerraLib.

Definition at line 283 of file Translator.h.

#define TERRALIB_TEXT_DOMAIN_DIR   "locale"

It contains the translation catalog directory.

Definition at line 290 of file Translator.h.