// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: September 2006 // // Description: // // // // // // 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. // // // // string $pluginName Unique Plugin name // string $fileName Name of string resource file to load // (filename only without path). // // // string : the string resource value associated with the key. // If the key is not found, the return value will be empty. // // // Plugin resources are defined using the registerPluginResources // and overriden (for localization) using the setPluginResource commands. // They are accessed using getPluginResource. // // // // 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"); // // // global proc loadPluginLanguageResources( string $pluginId, string $pluginResFile ) { // This is a no-op in a non-localized environment int $isLocalized = `about -uiLanguageIsLocalized`; if( !$isLocalized ) { return; } // Look for the file using the pluginLanguageResourcePath // A non-empty path returned from this routine is guaranteed to // point to an existing file. string $languagePath = pluginLanguageResourcePath( $pluginResFile ); if(( $languagePath != "" )) { eval( "source \"" + $languagePath + "\"" ); return; } else { } }