Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 11, 2010, 12:34:00 AM (14 years ago)
Author:
landauf
Message:

merged doc branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/Language.h

    r7284 r7401  
    2828
    2929/**
     30    @defgroup Language Language
     31    @ingroup Core
     32*/
     33
     34/**
    3035    @file
    31     @brief Definition of the Language and the LanguageEntry class.
     36    @ingroup Language
     37    @brief Declaration of the Language and the LanguageEntry class, as well as some helper functions.
     38
     39    @anchor LanguageExample
    3240
    3341    The Language class is used, to get a localisation of a string in the configured language.
     
    3745    Usage:
    3846     - Set the entry with the default string:
     47       @code
    3948       Language::getInstance()->addEntry("label of the entry", "the string to translate");
     49       @endcode
    4050
    4151     - Get the localisation of the entry in the configured language:
     52       @code
    4253       std::cout << Language::getInstance()->getLocalisation("name of the entry") << std::endl;
     54       @endcode
     55
     56    Example:
     57    @code
     58    int age = 20;
     59    AddLanguageEntry("user_age", "Age");
     60    std::cout << GetLocalisation("user_age") << ": " << age << std::endl;
     61    @endcode
     62
     63    Resulting output:
     64    @code
     65    Age: 20
     66    @endcode
     67
     68    The language entry is now defined in @a translation_default.lang:
     69    @code
     70    user_age=Age
     71    @endcode
     72
     73    We can add a translation for another language, for example @a translation_german.lang:
     74    @code
     75    user_age=Alter
     76    @endcode
     77
     78    Now change the language in @a orxonox.ini to "german":
     79    @code
     80    language_ = "german"
     81    @endcode
     82
     83    Now you will see the translated language entry in the resulting output of the above code:
     84    @code
     85    Alter: 20
     86    @endcode
    4387*/
    4488
     
    58102    // ###      LanguageEntry      ###
    59103    // ###############################
    60     //! The LanguageEntry class stores the default- and the translated string of a given entry in the language file.
     104    /**
     105        @brief The LanguageEntry class stores the default- and the translated string of a given entry in the language file.
     106
     107        This class belongs to the Language class.
     108    */
    61109    class _CoreExport LanguageEntry
    62110    {
     
    105153    // ###         Language        ###
    106154    // ###############################
    107     //! The Language class manges the language files and entries and stores the LanguageEntry objects in a map.
     155    /**
     156        @brief The Language class manges the language files and entries and stores the LanguageEntry objects in a map.
     157
     158        @see See @ref LanguageExample "Language.h" for some examples.
     159    */
    108160    class _CoreExport Language : public Singleton<Language>
    109161    {
     
    134186    };
    135187
    136     //! Shortcut function for Language::addEntry
     188    /// Shortcut function for Language::addEntry
    137189    inline void AddLanguageEntry(const LanguageEntryLabel& label, const std::string& fallbackString)
    138190    {
     
    140192    }
    141193
    142     //! Shortcut function for Language::getLocalisation
     194    /// Shortcut function for Language::getLocalisation
    143195    inline const std::string& GetLocalisation(const LanguageEntryLabel& label)
    144196    {
     
    146198    }
    147199
    148     //! Shortcut function for Language::getLocalisation without printing an error in case the label doesn't exist
     200    /// Shortcut function for Language::getLocalisation without printing an error in case the label doesn't exist
    149201    inline const std::string& GetLocalisation_noerror(const LanguageEntryLabel& label)
    150202    {
Note: See TracChangeset for help on using the changeset viewer.