How to translate (internationalize, localize) an application?

I need to translate the application to delphi. Now all the lines in the interface are in Russian. What are the tools for quick search, parrying all pas'es for string constants?

How do people translate large applications?

+6
source share
4 answers

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


If you only need to translate the GUI and possibly resourcestring to sources, and the built-in string constants in Pascal sources are not needed for translation, you can try the built-in Delphi method. However, the forums say that ITE is not working. But at least this is Delphi's official path.

To translate sources with the preparation of an ITM manual, it is necessary, as shown in the source code http://www.gunsmoker.ru/2010/06/delphi-ite-integrated-translation.html


I remember that I broadcast the Polaris texts for the JediVCL team, so they did some booty. But I think that they simply extracted all the characters> # 127 into a text file - there was no structure, there were constants and comments, all together. However, there is some kind of component, although I doubt that it can be used in the way you need: http://wiki.delphi-jedi.org/wiki/JVCL_Help:TJvTranslator


There are also commercial tools. But I do not know if their functions will help in your initial tasks of extraction and translation. They will probably be very useful when you need to translate your large application into many languages, but not when you need to do a one-time conversion. But maybe I'm wrong, check their trial versions if you want. According to reviews, these apartments are considered one of the best commercial:

+8
source

Firstly, I would recommend moving all localizable string constants to sections of the resource string inside their module files. I.e.

raise Exception.Create('Error: -    (in Russian language)'); 

will be converted to

 resourcestring rsSomeErrorMessage = 'Error: -    (in Russian language)'; ... raise Exception.Create(rsSomeErrorMessage); 

Learn more about resource strings.

This process can be accelerated using the Delphi IDE refactoring command or third-party utilities such as ModelMaker Tools .

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

+5
source

Basically, you have two ways

  • Resource-Based Localization Tools (Delphi ITE, Multilizer, ecc.)
  • Database-based localization tools (GetText, TsiLang, ecc.)

The first takes advantage of Windows resource support; when loading an application, resource loading can be redirected to another stored in the DLL. The advantages are that all forms can be localized, including images, colors, control sizes, etc., and not just lines. Moreover, code changes are not required. The disadvantages are that localization of the end user is usually not possible, and changing the language without restarting the application can be more difficult. These applications use Microsoft applications, including Windows itself. It will work with any Delphi libraries that store strings in resources and dfms correctly.

The latter stores the rows in an external "database" (it may even be a text file ...). The advantage, as a rule, is that users can add / change translations and it is easier to switch on the fly. The disadvantage is that this method is more intrusive (it should load / display a string), and code may need to be changed, tools are usually limited to localization of strings and do not provide wider control (images, sizes, etc.), and can work with unknown controls / libraries that they could not properly connect. Typically, a cross-platform application uses this technique because resource support under Windows is not available on all operating systems.

You better choose the technique that suits you and your application. In addition, some tools facilitate interaction with an external translator, while others do not. I prefer the resource based approach because it does not require code changes and does not bind me to this library.

+3
source

We use dxgettext (GNUGettext for Delphi and C ++ Builder) and Gorm (from the same author). Keep in mind that most tools require you to use English as your primary language and only translate from it. dxgettext allows you to use other languages, but this inevitably causes problems. Be prepared that internationalizing a large application will be more work than you currently think.

+1
source

Source: https://habr.com/ru/post/924816/


All Articles