neuray API Programmer's Manual

mi::neuraylib::IMdl_i18n_configuration Class Reference

[Configuration Interfaces]

Description

This interface is used to query and change MDL internationalization settings. Here is a sample pseudo-code to illustrate the usage of this component:

‎     // Get the internationalization configuration component
     using mi::base::Handle;
     using mi::neuraylib::IMdl_i18n_configuration;
     mi::base::Handle< mi::neuraylib::INeuray> neuray(...);
     Handle<IMdl_i18n_configuration> i18n_configuration(
             neuray->get_api_component<IMdl_i18n_configuration>());
     const char* locale = 0;

     // Set locale to French language
     i18n_configuration->set_locale("fr");

     // Query defined locale
     locale = i18n_configuration->get_locale();

     // Query system defined locale
     locale = i18n_configuration->get_system_locale();

     // Use system defined locale
     // NOTE: The system locale used internally is truncated to two-letters to follow ISO 639-1
     i18n_configuration->set_locale(i18n_configuration->get_system_keyword());

     // Disable any translation
     i18n_configuration->set_locale(0);

MDL Locale

virtual const char* get_locale() const =0
Returns the locale used to translate annotations. More...
virtual const char* get_system_keyword() const =0
Returns the reserved string which can be used to fallback to system locale. More...
virtual const char* get_system_locale() const =0
Returns the system locale. More...
virtual Sint32 set_locale( const char* locale) =0
Specifies which locale to use to translate annotations. More...

Member Functions

virtual const char* mi::​neuraylib::​IMdl_i18n_configuration::get_locale() const [pure virtual]

Returns the locale used to translate annotations.

Returns

  • the string passed to mi::neuraylib::IMdl_i18n_configuration::set_locale() or,
  • the system keyword mi::neuraylib::IMdl_i18n_configuration::get_system_keyword() or,
  • a NULL value if translation is disabled

virtual const char* mi::​neuraylib::​IMdl_i18n_configuration::get_system_keyword() const [pure virtual]

Returns the reserved string which can be used to fallback to system locale. See mi::neuraylib::IMdl_i18n_configuration::set_locale() for usage.

Returns

The reserved string which is used to fallback to system locale.

virtual const char* mi::​neuraylib::​IMdl_i18n_configuration::get_system_locale() const [pure virtual]

Returns the system locale.

Returns

The name of the locale set by the system or NULL if locale is not set.

virtual Sint32 mi::​neuraylib::​IMdl_i18n_configuration::set_locale( const char* locale) [pure virtual]

Specifies which locale to use to translate annotations. This interface can be used to set the locale to use for translation, overwrite the system locale or disable any translation. By default, the locale defined by the system is used.

This function can only be called before has been started.

Note:

The locale "C" is ignored and will disable any translation. By default the system locale is used.

Parameters

locale
The locale to be used. Values:
  • a string following ISO 639-1 standard (See https://en.wikipedia.org/wiki/ISO_639-1),
  • the system keyword (this will fallback to use system defined locale). See mi::neuraylib::IMdl_i18n_configuration::get_system_keyword().
  • a NULL value (this will disable any translation),

Returns

  • 0: Success.
  • -1: Failure. This function can only be called before has been started.