I’m currently working on a PHP project that needs to offer possibilities of internationalization, i.e. the application should be translatable into any language with minimal effort. Since I had already come to know the mechanics of gettext
from WordPress and was highly enthralled by its simpleness and effectivity, I decided to use this system for my project, too. It worked out very well, and I can only recommend gettext
to anyone who wants to develop a multilingual application!
However, when I wanted to have Poedit parse my files for text blocks, I always got the following error message:
Execution of command ‘dxgettext –so “C:\***\Temp\poe***.tmp” “some/path/file.inc”‘ failed (error 2: the system cannot find the file specified.)
Meanwhile I have found the mistake – but since I was not able to find a solution via Google when I needed it, I’ll just write it down here for anyone who may look for it in the future.
Considered in hindsight, the error message explains everything: Poedit has tried to apply the command dxgettext
to one of my include files (file.inc
), but no program called dxgettext
could be found on the computer. And why should it – dxgettext
is the gettext parser for the programming language Delphi, which I have not installed. After all, I’m writing my script in PHP, not in Delphi. Poedit however thinks by default that all files with the extension .inc
are Delphi files and therefore tries to parse them with dxgettext
.
Solution
There are two possibilities:
- Simply rename the problematic
file.inc
to something that Poedit will recognize as PHP file, for examplefile.inc.php
. - Tell Poedit not to handle
.inc
files as Delphi files anymore. For this purpose, just go to “File” → “Preferences” → “Parser” → “Delphi” and remove the extension*.inc
from the list. Now Poedit will ignore all.inc
files.