views:

512

answers:

7

I'm in the early stages of converting an older application and I'm trying to figure out the best way to implement multilingual support. I will be using Delphi 2010.

For example if I wanted to support English and Spanish (with other languages in the future). Should I use a database to to store all the form elements such as Menus, Buttons, Labels etc with a ForeignKey for each language (1=English 2=Spanish etc) and build all the elements on the fly?

Is this feasible? If not how should I go about supporting more than one language?

A: 

Use resource files.

monksy
+3  A: 

You have the old school approach: having every text that should be displayed in resourcestrings, have those replaced after creating the UI and before displaying it. It's just a matter of switching the resourcestrings by linking for instance to the correct language DLL.

You have the component approach, like TsiLang, where most often, there is a way to modify the translation a posteriori for the end-users if they want.

You also have the in-house special development including databases, some sort of Editor tool, and most importantly a way to translate things that are dynamic and unknown at development time, like some legalese that must appear in an invoice and that is user specific.

For the record, the last 3 big application I worked on where we needed internationalization, we took the last approach with different needs and different solutions, but that was the general idea.

And I'm not even talking about Unicode here....

François
We use TsiLang to localise our application and it works very well, especially when, as Francois says, you want to allow the end-user to customise the translation on the fly. We also use it to allow the user to change terminology, even within the same language. http://www.tsilang.com
_J_
+8  A: 

GNU Gettext for Delphi and C++ Builder is a open source translation toolkit for Delphi, C++ Builder, Kylix, FreePascal and Lazarus. It can be used for commercial, closed sourced, proprietary applications at no cost. No DLLs required and no DLLs involved. You can even embed the translations in the .exe file, so that your entire application deployment only consists of a single .exe file. Handles translation of numbered items (like '0 files', '1 file', '2 files' etc.) to languages with different ways of doing plural easily. And many features more.

mjustin
Never knew about this one, but it looks fantastic. Thanks. +1
lkessler
+1  A: 

Tools like Multilizer can read the resourcestrings and forms from your binaries. In Multilizer the translators can translate the resourcestrings and forms and even layout the form different or change bitmaps or fonts. You might need this if the translated text is longer then the original. No need to write any extra code, just make sure all the text in code are resourcestrings. Multilizer then generates translated binaries for each language. No extra DLLs needed.

Lars Truijens
+1  A: 

On CodeRage 4 there was an interesting session "How to write world ready applications in Delphi" by Jaakko Salmenius. It was on Friday, September 11, 2009 from 5:00am - 5:45am. Many aspects of building multilingual applications are discussed.

Erwin
@Erwin - Thanks for the link.
Cape Cod Gunny
A: 

I use Korzh Localizer and I'm very happy with.

You can include Language Manager in your soft and so end user can easily create new translation.

Hugues Van Landeghem
A: 

I use the plain old .ini files and the Developer Express's method cxGetresourceString(@MY_RESOURCE_STRING).

As simple as that.

Gad D Lord