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)
}
A localized string of the current language can be obtained with:
const maxon::Id databaseID {
"net.maxonexample.description" };
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