Go to: Synopsis. Notes. Return value. Related. MEL examples.

Synopsis

loadPluginLanguageResources(string $pluginName, string $pluginResourceFile)

Load localized values for string resources registered with a plugin. This procedure takes the name of a script file that will be sourced to override the default values for a plugin's resources with language-appropriate values.

This file will only be used if Maya is running in a localized mode and an appropriate file for the UI language can be found (see below). Otherwise the default values registered for the resources will be used.

This call should be invoked from the UI string registration procedures that are setup using MFnPlugin::registerUIStrings. When set up correctly it will be called during plugin load and will ensure that the strings are set correctly to their default or localized value for subsequent steps in the plugin's execution.

When maya is running in a localized mode, a language-dependent resource file with the given name will be searched for along MAYA_PLUG_IN_RESOURCE_PATH, and sourced if it is found.

MAYA_PLUG_IN_RESOURCE_PATH is constructed to contain the following locations: Maya's default resource location for the current localized language; language-subdirectories found in all module locations as MAYA_MODULE_PATH is processed.

Call getenv("MAYA_PLUG_IN_RESOURCE_PATH") to see the current value of the search path. It is only relevant in localized environments.

Notes

Plugin resources are defined using the registerPluginResources and overriden (for localization) using the setPluginResource commands. They are accessed using getPluginResource.

Return value

None

Related

getPluginResource, registerPluginResource, setPluginResource

Arguments

Variable Name Variable Type Description
$pluginNamestringUnique Plugin name
$fileNamestringName of string resource file to load (filename only without path).

MEL examples

  // Load localized resources for the plugin "myPlugin"  

  // when required. 

  // The resources are located in a file "myPluginStrings.res.mel"

  // No action will be taken if the file is not found. 

  loadPluginLanguageResources("myPlugin", "myPluginStrings.res.mel");