Orxonox
0.0.5 Codename: Arcturus
|
Declaration of the Language and the LanguageEntry class, as well as some helper functions. More...
#include "CorePrereqs.h"
#include <map>
#include <string>
#include <cassert>
#include "util/Singleton.h"
Go to the source code of this file.
Classes | |
class | orxonox::Language |
The Language class manges the language files and entries and stores the LanguageEntry objects in a map. More... | |
class | orxonox::LanguageEntry |
The LanguageEntry class stores the default- and the translated string of a given entry in the language file. More... | |
Namespaces | |
orxonox | |
Die Wagnis Klasse hat die folgenden Aufgaben: | |
Functions | |
void | orxonox::AddLanguageEntry (const LanguageEntryLabel &label, const std::string &fallbackString) |
Shortcut function for Language::addEntry. More... | |
const std::string & | orxonox::GetLocalisation (const LanguageEntryLabel &label) |
Shortcut function for Language::getLocalisation. More... | |
const std::string & | orxonox::GetLocalisation_noerror (const LanguageEntryLabel &label) |
Shortcut function for Language::getLocalisation without printing an error in case the label doesn't exist. More... | |
Declaration of the Language and the LanguageEntry class, as well as some helper functions.
The Language class is used, to get a localisation of a string in the configured language. The string is identified by another string, the label of the entry. If the translation in the configured language isn't available, the default entry, defined in the code, is used.
Usage:
Example:
Resulting output:
The language entry is now defined in translation_default.lang:
We can add a translation for another language, for example translation_german.lang:
Now change the language in orxonox.ini to "german":
Now you will see the translated language entry in the resulting output of the above code: