// =========================================================================== // 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. // =========================================================================== // // Description: // This script contains the procedures for // 1. Retrieving the localized version of the shelf tab label // from english values. // 2. Retrieving the shelf tab label in english from the localized values. // // This variable is not referenced. It is a convenient way to build // all the ui resources needed to translate the shelves names. string $gInternalShelfLabels[] = { (uiRes("m_shelfLabel.kFX")), (uiRes("m_shelfLabel.kFXCaching")), (uiRes("m_shelfLabel.kDynamics")), (uiRes("m_shelfLabel.kCloth")), (uiRes("m_shelfLabel.kFluids")), (uiRes("m_shelfLabel.kHair")), (uiRes("m_shelfLabel.kNCloth")), (uiRes("m_shelfLabel.kRendering")), (uiRes("m_shelfLabel.kCustom")), (uiRes("m_shelfLabel.kPaintEffects")), (uiRes("m_shelfLabel.kToon")), (uiRes("m_shelfLabel.kFur")), (uiRes("m_shelfLabel.kMuscle")), (uiRes("m_shelfLabel.kBullet")), (uiRes("m_shelfLabel.kXGen")), (uiRes("m_shelfLabel.kGeneral")), (uiRes("m_shelfLabel.kCurvesSurfaces")), (uiRes("m_shelfLabel.kCurves")), (uiRes("m_shelfLabel.kSurfaces")), (uiRes("m_shelfLabel.kPolygons")), (uiRes("m_shelfLabel.kSubdivs")), (uiRes("m_shelfLabel.kDeformation")), (uiRes("m_shelfLabel.kRigging")), (uiRes("m_shelfLabel.kAnimation")), (uiRes("m_shelfLabel.kSculpting")), (uiRes("m_shelfLabel.kMASH")), (uiRes("m_shelfLabel.kMotionGraphics")), (uiRes("m_shelfLabel.kShelf1")), (uiRes("m_shelfLabel.kShelf2")) }; // // Procedure Name: // shelfLabel_melToUI // // Description: // Returns the localized version of the shelf tab label. // // Input Arguments: // The shelf tab label in english. // // Return Value: // The localized version of the tab label. // global proc string shelfLabel_melToUI (string $melLabel) { string $resourceFile = "shelfLabel"; string $resourceName = "m_"+$resourceFile+".k"+$melLabel; // We cannot call uiRes directly, we do not want error on missing // resources. They may come from customer defined shelves. // check for kGeneral to make sure the resource file was loaded if( !`displayString -exists ("m_"+$resourceFile+".kGeneral")` ) { catch( initResources( $resourceFile+".res.mel" ) ); } if(`displayString -exists $resourceName`) { return `displayString -query -value $resourceName`; } return $melLabel; } // // Procedure Name: // shelfLabel_uiToMel // // Description: // Returns the shelf tab label in english. // // Input Arguments: // The localized version of the tab label. // // Return Value: // The shelf tab label in english. // global proc string shelfLabel_uiToMel( string $uiLabel ) { string $keys[] = `displayString -query -keys "m_shelfLabel."`; for ($key in $keys) { if ($uiLabel == uiRes($key)) { string $buffer[]; tokenize $key "." $buffer; if( size( $buffer ) == 2 ) { int $len = size($buffer[1]); return `substring $buffer[1] 2 $len`; } } } return $uiLabel; }