Saturday, July 22, 2017

Delphi XE5, dxgettext, Windows 10 : How To Make it all work together


Well I've returned to Delphi, once more. How could I not? Best tool of choice for desktop development (and then some! Mac, Mobile, and more)

Thing is, a few years ago I got used to developing my applications in English (my native language is Spanish), in order to have a multilingual solution from the very start. For that I've always used dxgettext, a free solution, quite efficient and relatively simple to implement.

Enter, Windows 10. Oh that beast.

It seems that something in the most recent Windows 10 releases has broken the implementation of dxgettext. I won't go too deep (I wouldn't know how!) but dxgettext seems to depend on Cygwin, and the Cygwin files in its distribution are way old (same as the package itself, but those are Delphi programs and they do work and work!) and when trying to do things like merging, or decompiling, you might get "bash.exe" running over and over in a loop, until eventually your Windows will hog and you'll have to use the POWER button. Ugly. 

This has been reported by others in here and here and also in the Yahoo Newsgroup.

Tried some of these solutions, involving changes in some DLLs but bash.exe kept coming up with its ugly head once and again.

So, after much testing, I came up with these steps below:
(Also for XE5, or any new Delphi, notice that you might need to use a different .pas unit for gnugettext.pas. See this Link for an updated version)


  1.  Download and fresh install dxgettext-1.2.2.exe from http://dxgettext.po.dk/download as admin. Restart.
  2.  Download Cygwin 32bit from https://cygwin.com/install.html  in a different folder from dxgettext (I took the default, c:\cygwin)
  3. Run setup-x86.exe and select  "Base" Package (Install).  Next, Select Required packages just in case.
  4. Move the following files from dxgettext folder to a backup folder (we'll use some DLL later): cyg*.dll and bash.exe
  5. Copy from c:\cygwin to the dxgettext folder the following files:

    • bash.exe  (set to run as admin)
    • cygwin1.dll
    • cygiconv-2.dll
    • cygintl-8.dll
    • cygreadline7.dll
    • cyggcc_s-1.dll
    • cygncursesw-10.dll


    1. Recover the file(s) below from the backup folder (See #4) and copy to the dxgettext folder.
        cyggettextsrc-0-14-1.dll,  cyggettextlib-0-14-1.dll and  cygintl-3.dll
    2. Running like this, you might get error 740 (requires elevation). So:   Set ggmerge.exe,ggfmt.exe to run as admin

    So far so good; I've tested Merging, Decompiling, Compiling and of course Extraction to Template (this one did work before) and it seems to run ok in my Windows 10 Version 1607 (Anniversary Update I think).

    Hope this can somehow be included in the distribution package; this is an awesome tool and I'm happy if it continues working with this small workaround. 


    No comments: