When I planned to release my shareware project in other languages, I searched for a simple but powerful tool which was able to create localized Resource Scripts (RC files). I didn't find any and so I started developing my own tool.
This tool, called LocalizeRC, scans Resource Scripts and extracts the language specific strings into an INI file. This file can be edited with any text editor. It then creates a new Resource Script with the translated strings from the INI file.
Although there is a lot of commercial software for translating resource files, I started developing LocalizeRC, because the other tools are all very complex and also very expensive. LocalizeRC is very easy to understand and makes it possible to create a translation within minutes! To supply more than one language just create a resource-only DLL from the Resource Script, which is created by LocalizeRC. The only disadvantage of LocalizeRC is that you have to compile the Resource Script for yourself. I will explain later, how to manage that.
Using the tool
First of all you have to create a software program in one language, like you normally do. All your translations start from this original language. My first language is always English, although I'm from Germany, because it is easier to find someone who is able to translate from English to his native language, than from German. But that is up to you...
Then you can start LocalizeRC and create a new workspace within a new folder (e.g. "German") by clicking on New.... As Input RC you should select the Resource Script in original language. For the Language INI and Output RC you should specify any filename for these files within the workspace folder (e.g. "German.ini" and "German.rc"). You can also choose any other folder but I recommend to have these three files in the same folder for reasons of clearness. Then click on the Create/Actualize INI from Input RC button.
Afterwards you can edit your Language INI with your standard editor by clicking the Open INI for Edit button. In the INI file there are two items per line. On the left side of the equals sign stands the original language. The rights side has to be replaced by the new language. You can also deploy this INI file to external translators. In the section [code_page] in the INI file, you can set the codepage that should be used in that RC. For a list of valid codepages look have a look at Links.
When you have finished translating the strings just save that INI file and close the editor. In LocalizeRC you should also check the option Copy Resource Header and "RES" Folder. Then the header "resource.h" and the files within the subfolder "RES" will be copied to the new folder which will later contain the Output RC. Afterwards you should click on the Create Output RC with INI button. Then LocalizeRC automatically creates the Output RC with the translated strings.
If you want to translate to Asian languages, you must perhaps use Unicode RCs, because some of these languages have more than 128/256 characters. Then you have to download the Unicode binary. Please notice that only Windows NT/2000/XP is fully compatible with Unicode.
As a result you should have created a folder with four files and one subfolder:
- the workspace itself (with the extension lws)
- the INI file (with the extension ini)
- the Output Resource Script (with the extension rc)
- the Resource header (resource.h)
- and a subfolder called "RES", which contains all the resources like Bitmaps, Icons etc. from the Original Resource.
To use these files in your application, you have to create a resource-only DLL.
Create a resource-only DLL (satellite DLL)
I describe these steps for Visual C++.NET (7.0 or 7.1), but it should be very similar in 6.0 and 5.0.
- Create a new Win32 Project in the folder, where the workspace and the Output RC files are
(you can add it to your workspace/solution if you want).
- In the wizard modify the application settings.
Set the application type to DLL and check the option Empty project.
- Then you have to add a few files to the new empty project.
Under Project->Add existing item select the Output RC, which you created with LocalizeRC, and the "resource.h".
- You can check now the translated dialogs and stringtable etc. in the resource view.
- Go to Project->Properties->Linker->Advanced and select yes for the value Resource Only DLL.
- Then you can compile the DLL
If you have got a MFC application, it will automatically load a satellite DLL if it has the filename ApplicationNameXXX.dll. The ApplicationName should be same name your application has (the filename without the extension .exe) and the XXX is a three-letter language code. MFC attempts to load the resource DLL for each of the following languages in order, stopping when it finds one:
- (Windows 2000 or later only) The current user's default UI language, as returned from the
GetUserDefaultUILanguage Win32 API.
- (Windows 2000 or later only) The current user's default UI language, without any specific sublanguage (that is, ENC [Canadian English] becomes ENU [U.S. English]).
- The system's default UI language. On Windows 2000 or higher, this is returned from the
GetSystemDefaultUILanguage API. On other platforms, this is the language of the OS itself.
- The system's default UI language, without any specific sublanguage.
- A "fake" language with the 3-letter code LOC.
If MFC does not find any satellite DLLs, it uses the resources which are contained in the application itself (independent from the language). To load a language DLL manually, do the following steps before loading any dialog (e.g. in
LoadLibrary for your language DLL then call
AfxSetResourceHandle to make MFC loading all resources from that DLL. At application exit you have to free the language DLL via
For an example you can look at the source code of LocalizeRC.
After getting some mails why not including more than one language into one Resource Script and also into one EXE/DLL I will try to explain it here. In old Windows systems (Windows NT/9X/ME) there was an automatic selection of the right language, if more than one language was available in one EXE/DLL. This selection works in most of the cases. But in modern Windows systems (Windows 2000/XP/2003) this automatic selection doesn't work any more because of internal changes (for more information read the KB article 300680). Microsoft recommends to pack only one language into one file and so do I. Even in Windows NT/9X/ME there is no simple solution to override the automatic selection by the OS.
LocalizeRC can either create ANSI or Unicode Resource Files (RCs). Because Windows 9X/ME doesn't fully support Unicode, you can only use the ANSI format with these Operating Systems. The Binary is different for these two versions. Please download the appropriate version or build them yourself.
ANSI files create strings with one byte for each character. That means that you can only store up to 256 different characters. That is enough to store the latin alphabet, but not enough for many other languages which uses much more characters. Therefore you need the Unicode format.
Unfortunately Visual Studio up to the current version 2003 isn't able to edit Unicode Resources. It only says: "Opened in another editor." However you can compile those resources without problems. So you must edit the RCs either with Notepad or another editor which is able to read and write Unicode. You find an example about Handling of Unicode Resources at the MSDN Library in the Links section.
I want to make LocalizeRC a real open-source software. Please send your additions/modifications and bugreports as well as typos in the website and the program to firstname.lastname@example.org. Also send your wishes for the next version. Please supply me with your translation for LocalizeRC. A new icon would also be very nice ;-).
This is the preliminary Todo list for LocalizeRC:
- Comparison of two RCs and create an INI from these (if you already have a translated RC)
- Include the ID of the button/dialog etc. in the INI
- Include FontName and FontSize in INI file (because of different fonts for other languages)
This project is a thank to all the great authors and helpful developers at Codeproject!
- 26.02.2003 - Release of LocalizeRC 1.0.
- 28.02.2003 - First Update to Version 1.1.
Can now be build under VC++6 (thanks to Chris Richardson), fixed some bugs.
- 30.03.2003 - Version 1.2 released
- Unicode version available
- fixed bugs:
- creating DLGINIT sections in OutputRC even works with preprocessor conditions
- extract all strings to INI, even if "BEGIN" or "END" occurs within a string
- even under Win9X RCs with a size above 64K are shown in the edit field (now using RichEdit)
- no invalid memory access while creating INI, if combobox strings have odd number of chars
- removed numbers from button captions
- automatically load InputRC to edit field, while loading workspace
- extract codepage to INI file
- 06.04.2003 - Version 1.3 released
- sorting changeable
- fixed bugs:
- correct newlines in UNICODE and ANSI (Notepad compatible)
- correct handling of BOMs (Byte Order Marks) in UNICODE
- DLGINIT sections work for more than one combobox in one dialog
- no "Out Of Memory" error, when extracting strings that have enclosed ENDs or BEGINs
- reopen InputRC before creating INIs
- no error if INI doesn't already exist
- 06.05.2003 - Version 1.4 released
- easier interface for workspace handling - 3 buttons: "new", "open", "modify"
- Cancel button in Create/Modify Workspace dialog
- fixed bugs:
- no "an unnamed file contains an invalid path" error while creating a new workspace
- also translates static-controls with SS_SUNKEN and SS_LEFTNOWORDWRAP attributes
- edit field for workspace filename is now read-only, because changing wasn't recognized if typed directly
- changes are saved at program exit to workspace file, because checkboxes have now NOTIFY attribute
- also recognizes multiline commands that end with spaces after the "|" (better compatibility with some Visual Studio versions)
- correct 16x16 icon in window
- 04.11.2003 - Version 1.5 released
- extended error messages
- easier workspace handling
- fixed some bugs
- added information about Unicode Resources to this website.
- 13.01.2004 - Version 1.6 released
- fixed bugs:
- empty captions in controls are correctly handled (thanks to Diego Tartara)
- captions containing an "=" are correctly handled (thanks to Diego Tartara)
- added information about multiple languages within one file to this website
- added Todo list to this website