0

The dxgettext Extract Translations GUI has a switch to Add likely ignores to ignore po file but I don't see the correspondent parameter when calling dxgettext as a command line.

I'm building a batch file doing several tasks when preparing a new release and I would like that the translations extraction step behaves similarly than when called from the UI, moving to a separate file the strings that will clearly not need to be translated.

These are the parameters that I'm using:

dxgettext -b MyProjectPath --delphi --nonascii -r --useignorepo --preserveUserComments

Thank you.

Marc Guillot
  • 6,090
  • 1
  • 15
  • 42

2 Answers2

1

I had the same problem as you do. Tho solve it for my OpenSource image organizer application, I use the following batch file to extract the strings from the sources and remove all strings to be ignored:

c:\Utils\dxgettext -b . --delphi --nonascii --no-wrap -o:msgid -o .
c:\Utils\msgremove default.po -i OvbImgOrganizerLanguageIgnore.po -o OvbImgOrganizerLanguage.pot --no-wrap
del OvbImgOrganizerLanguageDefaultBak.po
ren default.po OvbImgOrganizerLanguageDefaultBak.po

This batch is run with current directory being the source code directory.

fpiette
  • 11,983
  • 1
  • 24
  • 46
  • I think that your batch does the same thing that the UI `Remove items from default domain present in ignore.po file` switch (which I have activated with the `--useignorepo` parameter), not the `Add likely ignores to ignore.po file`. – Marc Guillot Oct 30 '20 at 13:15
  • I don't think it is. This seems to remove at default.po the strings from ignore.po, this is the switch `Remove items from default domain present in ignore.po file` on the dxgettext UI, and can be done with the `--useignorepo` command line parameter. But I'm looking for the correspondent of the switch `Add likely ignores to ignore.po file`, which creates a new ignore.po with the strings coming from known non-UI properties and components ... if I understand it correctly. – Marc Guillot Oct 30 '20 at 14:38
  • Where did you found "dxgettext Extract Translations UI" ? – fpiette Oct 30 '20 at 15:57
  • I mean the `uconfig` Form which appears first when you righ-click a folder and select the "Extract translations to template ..." action. – Marc Guillot Oct 30 '20 at 16:03
  • This is totally unknown for me. Which tool did you install to get that? – fpiette Oct 30 '20 at 17:39
  • The dxgettext installer registers it, but even the latest one is very outdated (1.2.2). :-( – Marc Guillot Oct 30 '20 at 19:32
  • It looks like we are no using the same dxGetText. I'm using http://svn.code.sf.net/p/dxgettext/code/trunk/ and there is no installer. – fpiette Oct 31 '20 at 07:19
  • Yes, I have both, the old 1.2.2, which had an installer, and the 1.3.0 (after you told me that my problem with the unicode files was due to being outdated). Anyway the GUI exists on both, they are the uWork.pas and uConfig.pas forms. The installer just registers the command "C:\Program Files (x86)\dxgettext\ggdxgettext.exe" "%1" to the Windows Folder Shell. – Marc Guillot Nov 02 '20 at 09:56
1

That dialog is provided by the GUI ggdxgettext tool.

By the look of it, the dxgettext command line tool does this automatically by default:

  item := dom.order.Objects[j] as TPoEntry;
  ignoreitem:=ignorelist.Find(item.MsgId);
  if ignoreitem=nil then begin
    newitem:=TPoEntry.Create;
    newitem.Assign(item);
    if not IsProbablyTranslatable( newitem,
                                   nil,
                                   nil) then
      ignorelist.Add(newitem)
    else
      FreeAndNil (newitem);
  end else begin
    ignoreitem.AutoCommentList.Text:=item.AutoCommentList.Text;
  end;

But I am not quite sure since I haven't tried to analyze the program flow.

The sources are available on SourceForge, so you can check yourself.

dummzeuch
  • 10,975
  • 4
  • 51
  • 158
  • None of the parameters I have tried resulted on a new ignore.po file (or the existing one getting updated) with those ignoreList entries. But thanks, I will try checking the source code. – Marc Guillot Oct 30 '20 at 16:13
  • Definitely it didn't save the IgnoreList when called by the command line. I have added an `--UPDATEIGNORE` parameter that sets `xgt.UpdateIgnore:=True;` on `TConsoleApp.Execute` and now it does as I expected. Thank you. – Marc Guillot Nov 02 '20 at 17:27
  • Would you be so kind to donate your changes? If so, please add a feature request on SourceForge and include the relevant code or even better, a patch. I would then add it to the repository. – dummzeuch Nov 04 '20 at 15:35
  • 1
    Gladly. I have added a patch. Thank you. – Marc Guillot Nov 04 '20 at 16:41