Facilitating Translation and Localization
 
 
 

3ds Max is sold in numerous countries outside Canada and the United States. To allow your plug-in to have the largest possible audience, it is a good practice to ensure that text strings used in the plug-in can be easily translated to another language, or easily adapted to differences in usage between countries that speak the same language.

To accomplish this, you should put all your language-specific strings into a separate resource-only DLL. In this way, only the resource DLL, and not the rest of the code, needs to be changed to move the application to another language.

The approach first involves creating a VC++ project that builds a separate resource DLL containing only the resources of the plug-in.

Then you must arrange for the resource DLL to be loaded. Among the various steps taken by 3ds Max to initialize a plug-in, it calls your LibDescription(), LibInitialize() and LibClassDesc() methods each of which should load your resource DLL if it is not already loaded. When 3ds Max is finished with your plug-in, it calls your LibShutdown() method which frees the resource DLL.

The DllMain() function is also called but it does very little processing. See Required DLL Functions for more information. The EPS image processing plug-in source code (in maxsdk\samples\images\eps) provides examples of how to separate resources that should be localized from processing.

The final step is to acquire the resource strings from the resource DLL as they are needed. The following code sample (taken from the EPS plug-in) shows how to load and use one of the strings from the resource DLL:

const TCHAR *EPSClassDesc::ClassName ()
{
   staticint loaded = 0;
   staticTCHAR stringBuf[MAX_STRING_LENGTH;
   if (! loaded)
   {
     LoadString (hResource, IDS_CLASS_NAME, stringBuf, MAX_STRING_LENGTH);
     loaded = 1;
   }
   returnstringBuf;
}

In summary, it is a good design practice to separate the literal strings of a plug-in into a separate resource-only DLL. This creates a globalized application with the potential to reach the largest possible audience.

Localization Codes

The following is the table of localization codes and three letter acronyms for the different localizations of 3ds Max 2011.

CHS Chinese - PRC 0804
DEU German - Germany 0407
ENU United States English 0409
FRA French - France 040C
JPN Japanese - Japan 0411
KOR Korean (Extended Wansung) - Korea 0412

To access the locale information for the current installation of 3ds Max you can use the functions MaxSDK::Util::GetLanguageID() and MaxSDK::Util::GetLanguageTla().

See Also