Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude DBGrid.Column.FieldName in .pot file

I made an application with Delphi 6. After that I extracted a .pot file with all the strings to translate. The problem is that there are strings that don't have to be tranlated, and if translated will generate problems.

Une of this is TDBGrid.Columns[x].FiedlName

I tryed to put this lines into the ggexclude.cfg file, but they doesn't work.

# exclude all occurences of the specified class
# and property in all DFM files in or below the
# path where "ggexclude.cfg" is in
[exclude-form-class-property]
TDBGrid......FieldName
TDBGrid.....FieldName
TDBGrid....FieldName
TDBGrid...FieldName
TDBGrid..FieldName
TDBGrid.FieldName
item.FieldName

TDBGrid.Columns.FieldName
TDBGrid.Columns.TDBGridColumns
TDBGrid.Columns.TDBGridColumns.FieldName
TDBGrid.Columns.Item.FieldName

TColumn.FieldName
TDBGridColumns.FieldName

FieldName

*.FieldName

I think that the problem is that within the .dfm file the parser doesn´t understand that they are part of a TColumn object

  inherited DBGTable: TDBGrid
    Height = 309
    DataSource = DMUsers.DSUser
    Columns = <
      item
        Expanded = False
        FieldName = 'USER'
        Visible = True
      end
      item
        Expanded = False
        FieldName = 'CODE'
        Width = 31
        Visible = True
      end
      item
        Expanded = False
        FieldName = 'NAME'
        Width = 244
        Visible = True
      end>
  end

Does anybody have a workarround?

I can't trust the automatic ignore.pot, because there are some strings that cause false possitives.

like image 830
Duilio Juan Isola Avatar asked Jun 09 '11 14:06

Duilio Juan Isola


People also ask

How do I exclude a column from an export?

A setting in the column object to allowExport which defaulted to true would allow me to set the option to false and exclude the column from exporting, while retaining the default action of including the column in the export. You can hide a column with custom content on the onExporting event and show this column on the onExported event.

How to exclude the column passed to ‘column_name’ in Dataframe?

The dataframe.columns != ‘column_name’ excludes the column which is passed to “column_name”. This can be achieved using dataframe.loc . This function access group of rows and columns respectively.

How to exclude particluar column of pandas Dataframe using Python?

Let us now look at ways to exclude particluar column of pandas dataframe using Python. The dataframe.columns.difference () provides the difference of the values which we pass as arguments. It excludes particular column from the existing dataframe and creates new dataframe. Look at the following code:

Is a column with custom content hiding in a data grid?

A column with custom content is not hiding in a data grid when data is exporting to excel because the beginUpdate and endUpdate methods are used. We will take your offer into account when planning our future development.


2 Answers

The documentation to the ggexclude.cfg-File states that you cannot access items, that are part of a collection:

A special case are collections in forms (like TDBGridColumns in a TDBGrid [...]) You can exclude only the whole collection, but not certain properties of a collection.

So the workaround would be to exclude the whole Columns-Collection:

TDBGrid.Columns

But this way you will lose Title.Caption too.

The only other workaround I see, would be to modify dxgettext. The following would be nice to have IMHO:

[always-exclude-property]
FieldName

Edit: I wanted to link to the ggexclude.cfg-documentation, but I cannot find it online right now. So I feel free to post the documentation as it is saved in my own ggexclude.cfg-file - but without any guarantee:

# Text in square brackets, like "[exclude-dir]", is called a "section".
# Each line that is not empty, not a comment and not a section holds 
# exactly 1 "value".
# All lines below a section are scanned for values belonging to that 
# section until the next section starts. You can use the same section 
# several times. It will all be added up.

[exclude-dir]
# This section prevents a whole folder and all it's subfolder from being scanned.
# Each value is exactly one folder. On Windows, it's not case-sensitive.
# You can use relative or absolute paths. No wildcards allowed.

# example:
# subfolder

# these are valid values as well:
# another\folder
# another\folder\
# Windows: D:\yet\another\folder
# Linux:  /home/zaphod/projects/subfolder/
# You don't have to worry about the path delimiters, both "/" and "\"
# can be used. They are converted to "/" internally

[exclude-file]
# This section prevents a whole file from being scanned.
# Each value is exactly one file. On Windows, it's not case-sensitive.
# You can use relative or absolute paths. Wildcards allowed.

# example:
# Unit4.dfm

# Using the wildcard ".*" for a file extension means that the following
# matching Delphi-files will be excluded: dfm, xfm, pas, inc, rc, dpr:
# Unit5.*

# If Unit3 is already excluded by the [exclude-dir] above, because it
# is located in a subfolder of "subfolder", listing it here therefore 
# has not further effect:
# subfolder\subfolder\Unit3.dfm

# you can use absolute paths as well, like this:
# on Windows: D:\test\Unit.pas
# on Linux:   /home/zaphod/projects/MainForm.*

[exclude-form-class-property]
# This section prevents a certain property of a class to
# be excluded from scanning in all forms of the folder and subfolders
# where "ggexclude.cfg" is located.
# The format for a value is "Classname.Properyname". It's not case-sensitive. No wildcards allowed.
# Classname is obvious, the propertyname has to be written the way it
# is written in the form file. If you're in doubt about how a certain property
# has to be stored here, just copy and paste the line from the DFM file here and
# put the classname before that.
# For simple strings the property name is one word:
# TLabel.Caption

# ...and for TStrings it's like this:
# TListbox.Items.Strings
# TMemo.Lines.Strings
# TQuery.SQL.Strings

# TEdit is listed in the [exclude-form-class]-section below which means
# that the whole class will be excluded. Listing TEdit.Text here therefore
# has no further effect
# TEdit.Text

# A special case are collections in forms (like TDBGridColumns in a TDBGrid,
# TParams in a TQuery or TActionManager.ActionBars). You can exclude only
# the whole collection, but not certain properties of a collection. That 
# means as well that in the case of nested collections (see TActionManager.ActionBars
# in the sample unit "nestedcollections.dfm"), everything that appears below
# the collection with the highest level will be ignored.
# Note that some collections are saved with another name than their propertyname. 
# For example: "TQuery.Params" will be saved as "ParamData" in the form file.  
# TQuery.ParamData
# TDBGrid.Columns
# TActionManager.ActionBars

# these lines won't work:
# TDBGrid.Columns.Title.Caption
# TActionManager.ActionBars.ContextItems
# ("ContextItems" is a nested collection, which can hold another nested collection and so on)

[exclude-form-class]
# This section prevents a whole class to
# be excluded from scanning in all forms of the folder and subfolders
# where "ggexclude.cfg" is located.
# The format for a value is just "Classname". It's not case-sensitive.
# A wildcard "*" can be used optionally.
# A special case are collections, see [exclude-form-class-property] for that

# Here, everything of TEdit in DFM/XFM-files will be ignored. Remember:
# other classes derived from TEdit have to listed seperatly in order to 
# exclude their properties as well. Inheritance is not recognized by dxgettext:
# TEdit

# Visual containers like TPanel or TScrollbox have to be treated slightly different. 
# If you have a TPanel with a TLabel on it, writing "TPanel" would only
# exclude the properties of TPanel itself. If you want to exclude
# everything contained in a TPanel, use the wildcard "*" at the end, like this:
# TPanel* 

# The following only excludes the properties of TScrollbox itself, but not the controls
# contained in Scrollboxes (except other classes explicitly listed here, like
# TEdit above):
# TScrollbox

[exclude-form-instance]
# This section prevents a certain instance (=object) of a class in a certain form file to
# be excluded from scanning.
# Each value is exactly one file with one instance. The format is 
# "filename:instancename". On Windows, the "filename" part is not 
# case-sensitive. You can use relative or absolute paths.
# Note that if the instance is something like a container or menu, 
# everything belonging to that will be excluded.
# Note also that a frame on a form might contain a component with the
# same name as a component on the form. They would both be excluded. 
# Unit6.dfm:Popupmenu
# Unit6.dfm:Label5
like image 103
yonojoy Avatar answered Sep 20 '22 15:09

yonojoy


You should probably try running

 msgmkignore filenamethatcontainsextrajunk.po -o autogenignore.po

Then open up the autogenignore.po and find the special way it has declared all your fieldname excludes (Thats the job of msgmkignore). Every time you auto-generate it you then have to review the auto-generated exclusion rules. It seems you're trying to generate all your exclusion rules by hand. It looks to me like you'd be better off taking the auto-generated includes and reviewing them by hand to exclude all the database field names and column names.

You obviously can't hand the entire job of "ignores" to the msgmkignore tool, as you state in your question, but you can use your brain, plus this tool, and combine those results.

like image 40
Warren P Avatar answered Sep 19 '22 15:09

Warren P