My first experience with the
Delphi 2009 Translation Tool

This article describes my first experience with the Delphi 2009 Translation Tool. Though it is supposed to be easy to use, the bumpyness of the experience exceeded my expectation.

Delphi 2009 is comprised of several tools aimed at improving applications developed in the IDE: the Translation Tool (ITE), the Refactoring Engine, Together and several others. I started with the Integrated Translation Tool because I had to localize an application. This article describes my experience.

Description

Internationalization and localization are important themes in Delphi 2009 and it includes updated and improved versions of the Integrated Translation Environment (ITE). It is a tool built into the IDE that enables developers to easily produce translated versions of an application. It is comprised of two helper tools: the Translation Editor and the Translation Repository. Except for the translation of the strings used in the user interface which may require an external translator, it is proposed as easy to use.

"ITE and ETM Tutorial for Delphi 2005" published by Embarcadero provides a tutorial that is complete and easy to follow so that I won't add to it here. Note that the main difference betwwen Delphi 2005 and Delphi 2009 is that Delphi 2009 produces Unicode applications.

How it works

In short, let's consider an example:

  1. Open the project that you want to localize (MyProject.dproj);
  2. Do Project Language Add to insert a new target language (French/Canada) with the Resource DLL Wizard: a new project called MyProject.FRC.dproj containing all the .dfm form files of the projects and a resource file called MyProject_DRC.rc;
  3. Double-click on these files and the Translation Editor will show-up and enable you to insert the translations of the elements appearing in these files. This can be a very lengthy operation that requires that you are competent in the target language. If not, give a contract to a professionel translator;
  4. Compile the MyProject.FRC.dproj project;
  5. Once this has been done, do Project SetActive. A list of languages will appear in a new window that includes the base language shown in between <...> as well as all the languages that have been added previously. Select the one that you added and click "Finish".
  6. Compile the projet and the executable that is produced will be localized to the locale that you chose.

Simple, isn't it!

My experience

Figure 1 - The projects

In order to familiarize with the Translation Tool I found the tutorial "ITE and ITM Tutorial for Delphi 2005" and used the proposed step by step approach to localize the example (from english to french): success! I tried the same procedure on another simple project: success again.

Localizing the GTRO_Asst project

Confident that another success was at hand. I started the localization of the GTRO_Assistant program. This program is written for a french audience. It was originally coded with Delphi 5.0, ported to Delphi 6 and eventually to Delphi 2009, without any problem.

It is a personal information manager that uses 14 forms, the BDE linking it with a Paradox database. In addition, the program uses the Quick Report components in order to print some database content.

The step-by-step approach failed

Using the step-by-step procedure from the reference above (it was written for Delphi 2009 and I believe that the procedure should be applicable to Delphi 2009).

  1. I dit File New Others Resource DLL Wizard and I completed the Resource DLL Wizard selecting "french-Canada (FRC)" as the base language and "english-Canada" as the localization language;
  2. The GTRO_Asst.ENC project was added to the project group and was as shown in Figure 1.
  3. I used the Translation Editor and translated a few strings in the PIM.dfm(selected to be obvious when running the program);
  4. I did Project Language Update Localized Projects and compiled all the projects;
  5. I dit Project Language Set Active and activated the french-Canada (FRC) language; and
  6. I did Run Run.

To my disappointment, the from that displayed was the original one: none of the selected strings had been translated. In addition, I noted that the GTRO_Asst.ENC file, a DLL should contain the translated resources was inexistant in the project directory though the HKEY_CURRENT_USER\Software\CodeGear\Locales entry of the registry contained the correct path to the project and the value ENC.

I repeated the procedure again and again to no avail. I always reached the same result: failure!

What's wrong?

Something was wrong! I started searching the Web for solutions and observed thay there were 8 extraneous form files in the GTRO_Asst.ENC project. The first two originate drom the BDE since they contain the login and the password dialogs. I assumed that the QRxxxx.dfm files originated from the Quick Report component suite that is used in the project.

When I tried to view the content of these QExxxx.dfm files in the Translation Editor, the page was blank whereas clicking on the "Show original form" icon caused an Access Violation exception. This meant that the ITE could not find the original forms on its search path.

My earlier search ef the Web for the details on the DBLOGDLG.dfm and DBPWDLG.dfm files had led me to the Embarcadero Discussion Forum, Report # 88777 entitled "ITE produces resource DLLs that do not compile" where a similar problem is discussed concerning the BDE for files and Delphi 2008 tanslation tool. I tought that the work around that is proposed therein could be my solution.

It was the solution

Quick Report installs its files in the C:\Program Files\CodeGear\RAD Studio\6.0\Quickrep504 directory. Though this path is in the Delphi 2009 search path on my computer, so that Delphi 2009 can use its DCUs and DFMs, the ITE does not use this sarch path. It seems to search the Delphi 2009 "lib" directory only.

Following the work around proposed above, I copied the Quick Report form files from the C:\Program Files\CodeGear\RAD Studio\6.0\Quickrep504 to the C:\Program Files\CodeGear\RAD Studio\6.0\lib directory. I regenerated the Resource DLLs, compiled the GTRO_Asst.ENC project and ran the GTRO_Asst project. The main form of the program displays the translated strings correctly and I observed that the GTRO_Asst.ENC file was in the project directory.

The question was posted on the Embarcadero Developer Network and, after this investigation, I provided the solution.

Conclusion

My first experience with the Delphi Translation Tool was bumpy but interesting. It could have been easier but my experience was plagued by an unexpected problem that I had to investigate and solve. If "easy in, easy out" is true, I will not forget the experience.

My problem arose from the use of Quick Report but other developers may face similar problems with other third-party component suites. I hope that this article may help them.


Questions or comments?
E-Mail
Last modified: September 3rd 2014 12:11:10. []