xdesksoftware.com Home    Desktop products    Programming    About us

  EasyMultilingual/C++     Downloads    Register     FAQ    

 

EasyMultilingual/C++ is not a "magic solution" that will fix all your problems, nor is it something that will translate automatically your programs with no effort from you (and if that's what you are looking for then you will probably have to continue searching :)

EasyMultilingual/C++ is a practical solution for a number of practical problems:
- a way to provide your customers with other translations/versions of the user interface of your C/C++ program!!!
- the solution must be SIMPLE for both the programmers but especially for the potential translators or customers;
- the solution must be very COST-EFFECTIVE! (you will not need a 500 US$ tool for each of your translators, actually all what's needed on their end is the old WordPad program (NotePad also works) that is coming free with Windows :)
- the solution must be easy to EXTEND in the future;
- the translations must be easy to maintain when new versions of your programs are published;
- the solution must be appealing for potential translators (so that you will get translations for your programs at a very decent price or simply in exchange for your product).

Our solution is to place all the information that needs to be translated into a simple TEXT FILE (with a simple format which can be used for further processing like automatic translation) and our EasyMultilingual/C++ package contains all what's needed in order to automate the process of:
- generating those files from your programs;
- loading the information back from the translated file and using it accordingly;
- updating both the original and the translated files each time a new version is published.

Please note that EasyMultilingual/C++ is a PROVEN SOLUTION - since it is exactly what we use for our end-user products XDESK, SysTrayX and XFilesDialog - you can download them and take a look at the results!!! (and please note that all those translations were made by very happy users of the corresponding program!) You can also take a look at our translations page which contains all the information needed for a translator to start his/her work (under the "How to create a translation" section)!

This initial version of EasyMultilingual/C++ will only help with the localization of STRINGS, MENUS and DIALOGS (also MessageBox-es) and it requires a certain amount of effort from the programmer - but this effort can be VERY SMALL if your program was already written following certain rules!!

1) All items that might require translation should be WIN32 RESOURCES - in other words something like:
printf("Hello world\n");
will NOT be translated but
LoadString(hinstance, id, buff, buff_max);
printf(buff);
will be just fine!

2) Our libarary will have to be added to your project and certain constants and variables will have to be defined.

3) Certain calls will have to be replaced, for instance all:
LoadString(hinstance, id, buff, buff_max);
will have to be replaced with:
LoadStringX(hinstance, id, buff, buff_max);
(but that will take only a few seconds since it can be done automatically with "Find and Replace" from your editor!!!)
Also for messages which are not using resources and LoadString the corresponding resources will have to be defined and:
MessageBox(hwnd, buff_text, buff_caption, type);
will have to be replaced with
MessageBoxTranslated(hinstance, hwnd, text_id, caption_id, type);
Finally for simple (not owner-draw) menus:
HMENU hmenu = LoadMenu(hinstance, MAKEINTRESOURCE(IDR_MENU_WINDOW));
int cmd = TrackPopupMenu(hmenu, ...);

will become
HMENU hmenu = LoadMenu(hinstance, MAKEINTRESOURCE(IDR_MENU_WINDOW));
TranslateMenu(hmenu, IDR_MENU_WINDOW);
int cmd = TrackPopupMenu(hmenu, ...);

4) Things will be a little more complex with some special situations, for instance owner-draw menus and dialogs, since certain extra processing takes place between the moment when the resource is loaded and the moment it is used or the resource is displayed using your own custom data and code (as with owner-draw menus)!
4a) Usually with owner-draw menus where your custom data is derived from MSAAMENUINFO and your code is using that information (MSAAMENUINFO.pszWText) to draw each menu item, a call to TranslateMenu should be enough (and the translated information will also be used automatically by accessibility programs like screen readers), for other owner-draw menus you will have to provide a custom callback function.
4b) With dialogs things are also quite easy, you will have to add a call to TranslateDialog when you handle WM_INITDIALOG or with dialogs that are used as property sheets you will also call CreatePropertySheetPageX instead if CreatePropertySheetPage!

5) You will also have to add to your program a simple way to change the user interface at run-time, but the following functions are provided:
BOOL InitLanguageCombo(HWND hcombo);
BOOL ApplyLanguageCombo(HWND hcombo);
BOOL InitLanguageCopyright(HWND hedit);

6) Finally the original language file will be generated automatically by SaveResAsLng and you will have to add that file to your setup program - together with any other (translated) files that you would like to add to the special LNG folder!

7) When at a later time you have a new version you can use a special function from our library ( UpdateResAsLng ) in order to update automatically ALL the existing translations - information for new or changed items will be added and the translation for old items will also be preserved with a special name so that the work of your translators will be greatly simplified!