Show: Delphi C++
Display Preferences

Creating Resource DLLs

From RAD Studio
Jump to: navigation, search

Go Up to Using Resource DLLs

Isolating in resource files your application resources and used in your code strings that you present to the user (such as error messages) simplifies the translation process. The next level of resource separation is the creation of a resource DLL. A resource DLL contains all the resources and only the resources for a program. Resource DLLs allow you to create a program that supports translations to several languages simply by swapping the resource DLLs corresponding to these languages.

Use the Resource DLL Wizard to create resource DLLs for your program. First, use the Resource DLL Wizard to add languages to your project. For each language that you add, the Resource DLL Wizard generates the resource DLL project. It creates each resource DLL project in the subdirectory with the name based on the language's locale. In each created resource DLL project the Resource DLL Wizard creates:

  • the RC file that contains the string tables from used RC files (.drc) and strings declared in resourcestring sections of the project;
  • the .dfm form file that stores forms and other GUI resources.

Using the created resource DLL project RAD Studio can build the resource only DLL that contains resources from the relevant form file and RC file.

You should use the Resource DLL Wizard to create a resource DLL for each translation you want to support. Each resource DLL should have a file name extension specific to the target locale. If you use the Resource DLL Wizard, it handles this for you. Otherwise, use the three-character ISO 639x values from the table in the "Language Culture Names, Codes, and ISO Values" to specify an extension based on the language's locale.

/* This callback fills a listbox with the strings and their associated languages and
 countries */
BOOL __stdcall EnumLocalesProc(char* lpLocaleString) {
        AnsiString LocaleName, LanguageName, CountryName;
        LCID lcid;
        lcid = StrToInt("$" + AnsiString(lpLocaleString));
        LocaleName = GetLocaleStr(lcid, LOCALE_SABBREVLANGNAME, "");
        LanguageName = GetLocaleStr(lcid, LOCALE_SNATIVELANGNAME, "");
        CountryName = GetLocaleStr(lcid, LOCALE_SNATIVECTRYNAME, "");
        if (lstrlen(LocaleName.c_str()) > 0)
                Form1->ListBox1->Items->Add(LocaleName + ":" + LanguageName + "-" +
        return TRUE;
/* This call causes the callback to execute for every locale */
EnumSystemLocales((LOCALE_ENUMPROC)EnumLocalesProc, LCID_SUPPORTED);

See Also

Personal tools
In other languages
Previous Versions