About
Data Descriptions store descriptions of attributes. This includes the translated names of these attributes in various languages. Using maxon::Resource and maxon::LanguageInterface it is easily possible to access such translated strings.
- Note
- maxon::Resource::LoadResourceString() and maxon::LanguageInterface::LoadResourceString() access the same data as maxon::DataDescriptionDatabaseInterface::LoadDescription().
Resources
The maxon::Resource class gives access to the supported languages:
  
 
  
 
  
 
  
  for (const 
maxon::LanguageRef& language : languages)
  {
    
 
    
    if (currentLanguage == language)
  }
static MAXON_METHOD Result< BaseArray< LanguageRef > > GetAllLanguages()
static MAXON_METHOD LanguageRef GetCurrentLanguage()
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:170
The maxon namespace contains all declarations of the Maxon API.
Definition: autoweight.h:21
#define iferr_return
Definition: resultbase.h:1531
 A localized string of the current language can be obtained with:
  
 
  
  const maxon::Id   databaseID { 
"net.maxonexample.description" };
 
 
  
Definition: apibaseid.h:243
Definition: datatypelib.h:32
Result< void > Init(const Id &i)
static MAXON_METHOD String LoadResourceString(const Id &scope, const InternedId &keyValue)
Definition: string.h:1287
Language
The properties of a language object are accessed with:
  
 
  
 
  
  const maxon::Id     languageId = language.GetIdentifier();
 
 
 A localized string of a given language can be obtained with:
  
 
  
  const maxon::Id   database(
"net.maxonexample.description");
 
 
  
  const maxon::String      localizedString = language.LoadResourceString(database, attribute);
 
Further Reading