Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to translate (internationalize, localize) application?

I need to translate an application on delphi. Now all strings in interface on Russian. What are the tools for fast find, parcing all pas'es for string constants?

How people translate large applications?

like image 341
Tres Avatar asked Sep 07 '12 04:09

Tres


People also ask

What is internationalization vs localization?

Internationalization is the process of preparing products, services, and internal operations for expansion into global markets. Localization is the adaptation of a specific product or service to a unique local market.

What is the difference between translation and localization?

Translation is the process of changing your text into another language, but localization is far more wide-reaching. It considers the cultural, visual and technological aspects of changing a site for users in different languages. In fact, translation can be considered as just one part of the localization process.


4 Answers

GetText should be able to do, search for "extract" at http://dxgettext.po.dk/documentation/how-to


If all you need is to translate GUI and maybe resourcestring in sources, and the inline string constants in Pascal sources are not needed for translation, then you can try Delphi built-in method. However forums say that ITE is buggy. But at least that is official Delphi way.

  • http://edn.embarcadero.com/article/32974
  • http://docwiki.embarcadero.com/RADStudio/en/Creating_Resource_DLLs

To translate sources with ITM manual preparation is needed as shown in source sheets at http://www.gunsmoker.ru/2010/06/delphi-ite-integrated-translation.html


I remember i tranlsated Polaris texts for JediVCL team - so they did some extraction. But i think they just extracted all characters > #127 into a text file - there was no structure, there were constants and comments, all together. Still, there is some component, though i doubt it can be used the way you need: http://wiki.delphi-jedi.org/wiki/JVCL_Help:TJvTranslator


There are also commercial tools. But i don't know if their features would help you on your initial extraction and translation tasks. They probably would be of much help when you need to mantain your large application translated to many languages, but not when you need to do one-time conversion. But maybe i am wrong, check their trial versions if you wish. By reviews those suites are considered among best of commercial ones:

  • TsiLang Suite http://www.tsilang.com/?siteid2=7
  • Korzh Localizer http://devtools.korzh.com/localization-delphi/
like image 170
Arioch 'The Avatar answered Sep 22 '22 06:09

Arioch 'The


Firstly I'd recommend to move all localizable string constants into the resource string sections within their unit files. I.e.

raise Exception.Create('Error: что-то пошло не так (in Russian language)');

will be converted to

resourcestring
  rsSomeErrorMessage = 'Error: что-то пошло не так (in Russian language)';
...
raise Exception.Create(rsSomeErrorMessage);

More about Resource Strings.

This process can be accelerated by using the corespondent Delphi IDE refactoring command, or with third-party utilities like as ModelMaker Tools.

Then you can use any available localizer to translate or even internationalize your program. I'd recommend my Delphi localizer - it's free.

like image 41
Kryvich Avatar answered Sep 24 '22 06:09

Kryvich


Basically, you have two ways

  1. Resource-based localization tools (Delphi ITE, Multilizer, ecc.)
  2. Database-based localization tools (GetText, TsiLang, ecc.)

The former takes advantage of the Windows resource support, resource loading can be redirected to a different one stored into a DLL when the application is started. The advantages are that whole forms can be localized, including images, colors, control sizes, etc. and not only strings. Moreover, no code change is required. The disadvantages are that end-user localization is not usually possible, and changing language without restarting the application may be trickier. Microsoft applications, including Windows itself, use this technique. It will work with any Delphi libraries that stores strings into resources and dfms properly.

The latter stores strings in an external "database" (it could even be a text file...). The advantage is usually that users can add/modify translations, and switching language on the fly easier. The disadvantages are this technique is more intrusive (it has to hook string loading/display) and may require code changes, tools are usually limited to string localization and don't offer broader control (images, sizes, etc.), and may not work with unknown controls/libraries they could not hook correctly. Usually cross-platform application use this technique because Windows-like resource support is not available on all operating systems.

You should choose the technique that suits you and your application best. Moreover some tools ease the collaboration with an external translator, while others don't. I prefer the resource-based approach because it doesn't require code changes and don't tie me to a given library.

like image 35
Mad Hatter Avatar answered Sep 20 '22 06:09

Mad Hatter


We are using dxgettext (GNUGettext for Delphi and C++ Builder) and Gorm (from the same author). Mind you, most tools require you to use English as the primary language and translate from that only. dxgettext allows other languages but there are bound to be unknown problems with that. Be prepared that internationalizing a large applicatin will be more work than you currently think.

like image 41
dummzeuch Avatar answered Sep 24 '22 06:09

dummzeuch