Jump to content
Ruslan

Internationalizing Applications

Recommended Posts

I am trying to Internationalize a application using integrated Delphi feature using documentation.

After the application is created I use "Resource DLL Wizard" and translated obtained forms.

In documentation it is said that the application will automatically be translated by system locale settings, but also I would like to change the UI language from application settings.

To test the application in different language I set the language from Project->Languages->Set Active, all builds and compiles but not working, an execution error rises

Exception EResNotFound in module ExHome.exe at 00250A7D.
Resource TfrmFDGUIxFormsError not found.
Exception EClassNotFound in module ExHome.exe at 00065F62.
Class TFDGUIxErrorDialog not found.

Don't know how to fix that. Tried to remove FDGUIxWaitCursor and FDGUIxErrorDialog from project datamodule, but no luck.

 

And the second question is how to change the language from application settings and use that language on next start?

Can I save the current application language in a INI file?

And how to add other translations for strings (messages, exceptions, etc.) used in units?

 

Delphi 10.3

Application with FireDAC SQLite database

Edited by Ruslan

Share this post


Link to post
On 9/30/2021 at 8:05 PM, Ruslan said:

I am trying to Internationalize a application using integrated Delphi feature using documentation.

I'm afraid the integrated localization tools has been officially deprecated. Unfortunately the documentation still hasn't been updated to reflect this fact.

https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Release_Notes#Translation_Tools

Quote

Translation Tools

As of RAD Studio 10.3 Rio the translation tools available in the product, both for VCL (Integrated Translation Editor) and for FireMonkey (TLang), are officially deprecated and removed from active support. Both features are still available in Rio but it is recommended to reduce your project reliance on them. RAD Studio is teaming with third-party vendors to offer alternative options.

 

So your best option is to use one of the many alternatives available. There exist both commercial and freeware solutions. I'm the author of one of the freeware solutions (the one linked to by Darian above) so I'll leave it to others to list the pros and cons of the different alternatives.

  • Like 2

Share this post


Link to post

That is worrying. Remove a feature without offering a replacement. Somehow Embarcadero  couldn't manage to create a stable and usable translation tool all these years? Even more worrying. While one determined man can create a decent tool as shown here. Did I say it is worrying? Then again, we can't even assign shortcuts to external tools. We can't hilite all occurrences of the selected word. We.. o enough ramblings already. Anyway, one industry standard seems to be GetText po files. IDE integration would be nice. Ha...

  • Like 2

Share this post


Link to post

I can't say that I disagree wrt the localization tools. I only wish they would have admitted that they were completely broken (apparently beyond repair) 20 years ago, and deprecated it then, so we didn't have to waste time on that dead end.

That said, while the ITE/ETM tools never worked, the RTL part of the localization system (i.e. resourcestrings, resource modules, etc) has always worked very well IMO.

 

With regard to gettext/PO-files I've never had much success with it because it basically just translates phrases without regard for context. There are functions in gettext to translate with context, but the context has to be specified explicitly in code.
https://www.gnu.org/software/gettext/manual/html_node/Contexts.html

  • Like 2

Share this post


Link to post
1 hour ago, Anders Melander said:

With regard to gettext/PO-files I've never had much success with it because it basically just translates phrases without regard for context. There are functions in gettext to translate with context, but the context has to be specified explicitly in code.
https://www.gnu.org/software/gettext/manual/html_node/Contexts.html

While using default phrases as keys looks nice at 1st glance, such nuances just kill all benefits of this approach IMHO. Not talking about a case of key phrase modification. I prefer another approach when each phrase has its artificial code. This one is used in all Android apps so does pretty well.

Edited by Fr0sT.Brutal
  • Like 1

Share this post


Link to post

I'm using dxgettext for at least 10 years, and I can say "IT WORKS" but you have to manage many things...

I've never tried other ways, however... and this is my limit.

Any languages have its rules for plurals, and the same term could change meanings depending on the place where it is used.

You have to spend a lot of time creating simple but clear initial English texts.

 

https://youtu.be/Ac3xV1X7uzE

For dxgettext you can use PoEdit editor which helps a lot for initial translations using Google or MS online translations servicies.

 

 

 

 

 

  • Like 1

Share this post


Link to post
54 minutes ago, shineworld said:

I'm using dxgettext for at least 10 years, and I can say "IT WORKS" but you have to manage many things...

I've never tried other ways, however... and this is my limit.

Any languages have its rules for plurals, and the same term could change meanings depending on the place where it is used.

You have to spend a lot of time creating simple but clear initial English texts.

 

https://youtu.be/Ac3xV1X7uzE

For dxgettext you can use PoEdit editor which helps a lot for initial translations using Google or MS online translations servicies.

Unfortunately there are two problems with dxgettext:

  1. Maintenance is basically nonexistent (apart from the odd fix I apply and my time is very limited). The original maintainer Lars B. Dybdahl hasn't committed any changes for years (the last log entry that from somebody else but me was in 2014)
  2. It only works for Windows, and there probably only for 32 bit VCL (I haven't tested 64 bit or FMX, but since it installs some hooks, it's unlikely to work without changes.)

Regarding PoEdit: I prefer using Lars' tool "Gorm" nowadays, but that's because I have the source code. 😉

  • Like 1

Share this post


Link to post

dxgettext works for 32 and 64-bit VLC applications with Sydney 10.4.1

I  build either version of the same big application.

Never tried FMX.


These are the files that I've used with either.

 

extra.zip

Edited by shineworld
  • Like 1

Share this post


Link to post

PyScripter uses dxgettext and it uses www,transifex.com for managing the translation team, which provides workflow and github integration.   This is important if a team is working on different translations.

 

However the fact that is not actively maintained is a serious issue.  Jvcl contains a fork but this is also not maintained.   You have to fix the bugs yourself. And there are some bugs, although it is generally solid.   

 

Regarding platforms the file I am using from Jvcl has the following:

 

{$ifdef MSWINDOWS}
  Windows,
{$else}
  Libc,
{$ifdef FPC}
  CWString,
{$endif}
{$endif}

So it does not appear to be Windows or Vcl dependent, but I have not tried.

 

Gettext does support context specific and plural translations, but they take some effor to implement.   If you just translate forms and resource strings there is not much need to mess up the source code, except for adding ingnore class/property directives.

Fpc includes its own gettext unit, unrelated to dxgettext.  Python also has gettext standard module based on GNU gettext.
 

Share this post


Link to post
On 10/4/2021 at 6:46 AM, shineworld said:

Any languages have its rules for plurals, and the same term could change meanings depending on the place where it is used.

Here is an open source API for Delphi to handle plurals and genders. The API uses the industry standard ICU message syntax.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×