examples/core/translator/main.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3 
4  This file is part of the TerraLib - a Framework for building GIS enabled applications.
5 
6  TerraLib is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License,
9  or (at your option) any later version.
10 
11  TerraLib is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with TerraLib. See COPYING. If not, write to
18  TerraLib Team at <terralib-team@terralib.org>.
19  */
20 
21 /*!
22  \file terralib/examples/core/encoding/main.cpp
23 
24  \brief Examples for the Terralib Encoding Module
25 
26  \author Matheus Cavassan Zaglia
27 */
28 
29 // TerraLib
32 
33 // STL
34 #include <cstdlib>
35 #include <iostream>
36 
37 int main(int argc, char *argv[])
38 {
39  // Add your your text domain, will throw and error if was already added
40  TE_ADD_TEXT_DOMAIN("terralib_example_core_translator", te::core::FindInTerraLibPath("share/terralib/translations"));
41 
42  TE_TR_LANGUAGE("pt_BR");
43  std::cout << TE_TR("This text will be in portuguese if your system locale is pt_BR") << "\n";
44 
45  TE_TR_LANGUAGE("en_US");
46  std::cout << TE_TR("This text will be in portuguese if your system locale is pt_BR") << "\n";
47 
48  std::cout << TE_TR("This text will remain the same, because there is no translation for it.") << "\n";
49 
50  return EXIT_SUCCESS;
51 }
This file is a wrapper around platform specific include files.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
#define TE_TR_LANGUAGE(locale)
It sets the locale for the Translator.
Definition: Translator.h:278
#define TE_ADD_TEXT_DOMAIN(domain, dir)
It adds the given text domain and its directory to the multilingual system.
Definition: Translator.h:225
int main(int argc, char *argv[])
This class is designed for dealing with multi-language text translation in TerraLib.
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.