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()
for(i=0;i< length;i++)
Definition: unicodeobject.h:61
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
The maxon namespace contains all declarations of the MAXON API.
Definition: autoweight.h:14
#define iferr_return
Definition: resultbase.h:1521
A localized string of the current language can be obtained with:
const maxon::Id databaseID {
"net.maxonexample.description" };
Definition: apibaseid.h:237
Definition: datatypelib.h:31
Result< void > Init(const Id &i)
static MAXON_METHOD String LoadResourceString(const Id &scope, const InternedId &keyValue)
Definition: string.h:1235
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