Loading...
 
Skip to main content

Multi-Language Add-In for Visual Studio


Please assist to remove unwanted string!!!

Hi,

My project has numerous string in those format: .SortExpress, .DataFormatString, .Value.
I am new to multi-language, Could you please help me how to remove those from the scanned list so that it will not be imported into Local resource file.

Thanks a lot.

Germany

Hi,

I'm not really sure whether you mean in the source code, or as properties of controls, so lets look at both.

In the source code

Suppose you have a function like this.

VB example with hidden line
Copy to clipboard
Private Sub TestFunction() Dim a As Object = Nothing a.SortExpress = "Text" a.DataFormatString = "Text" a.Value = "Text" End Sub

After scanning the project, they will appear in the grid like this:
Image

To remove them from the grid you have to:

  • mark the lines as hidden, by clicking on the sun symbol
  • actually remove them from the grid by clicking on the moon/sunset symbol on the toolbar, so that it changes to a sun symbol (which is actually the pressed state).


When you hide a line in the source code, the comment //MLHIDE (C#) or 'MLHIDE (VB) will be added to the end of the line, to mark it as hidden.

VB example
Copy to clipboard
Private Sub TestFunction() Dim a As Object = Nothing a.SortExpress = "Text" 'MLHIDE a.DataFormatString = "Text" a.Value = "Text" End Sub

Of course, you can add this comment yourself if you like. After rescanning the project, the line will be hidden.

If you have lots of lines like this, then you can use the function Filter using regular expressions to find them all. To use this function, you have to know only a very little about regular expressions.

You can start this function in several ways:

  • via the tools menu on the toolbar
  • via the context menu on the sun/moon symbol
  • via the context menu on the checkbox


This opens the following dialog:
Image
This function works in one of two ways:

  • Compare to string only
    In this mode it tries to match the text string (in inverted commas).
  • Compare to source code line
    In this mode it tries to match the complete line in the source code.


You need to select the option Source code line.

To find the string .SortExpress you must enter \.SortExpress, because . is a special character in regular expressions.

The Action you want to choose is HIDE, which means that when it finds this the string, it will hide it (by adding the 'MLHIDE or //MLHIDE comment).

The dialog should now look something like this:
Image

If you selected the option Prompted, then when it finds the string it will show it in the code editor and open the following dialog:
Image

When you click on Yes it will add the MLHIDE comment and search for the next one. If you have a lot, then you will probably want to click on Yes to all. Checking the first few helps build your confidence, that the Add-In is doing the right thing.

When it is completed, you will have to click on the moon/sunset icon on the toolbar to actually remove the lines from the grid.

As properties of controls

If you are talking about the properties of controls, which have been set in the form (or ASP or WPF) designer window, then it is much easier.

Simply open the context menu on the sun/moon icon and select Hide property "SortExpress" everywhere.
Image
(Here the property is called Text, but if you have a line in the grid with the property SortExpress, then it would be SortExpress.)

I hope that helps you (and maybe some others as well 😊)
Phil


Hello lucifertran,

  • If you are referring too attributes of asp.net web controls tat show up in the markup than you can only target properties that have the attribute "Localizable" by going into settings->Web


I have requested this feature since the addon could otherwise miss string (not all developers are diceplined to decorate their localisible attributes, even the MS employees cfr. Ajax Toolkit)

By default the addon will condider all properties as localisable. This is the default I suggested to Phil since this produces few false positives in my *current* project. The default is debatable but it is best to start out with too much than too few.

  • For Phil. I didn't know about the feature below

Image


(I should read the manueal one day 😉 )

I am a bit reluctant to give it a try though. I "hide property Text everywhere" does it hide all properties called "Text" or does it only hde the Text property for the the class that is selected, for example TextBox.Text ? I don't know if you go as far as to understand the underlying type.

I think its only useful if it does it for the current Type which is the only sensible call the developer can make.

Assuming it realy does change all the properties with the name (as the text kindiff indicated 😊 )
Lets say that we have a property called P on class X and Y. If I choose to ignore P in the context of X the addon will also hide Y.P (can go undetected). Also, if I later introduce a calss Z with a peroperty called P will it then hide P as well (again confusing)

Regards, Tom

Germany

Tom,

this is a really stupid function, which simply hides any property with the same name, even if it is not really the same property.

Very early versions of the Add-In in did not filter out empty strings. This meant that there could be a lot of junk, which you would probably want to hide. For example, all windows forms controls have properties AccessibleDescription and AccessibleName, which most developers probably do not use.

I may have implemented the "hide " function before the more obvious feature of suppressing all empty strings.

It looks like I store the full type name after the scan, so technically it would be easy to match both the property name and the control type. Maybe I should 'fix' this feature.

By the way, there are special context menus on the sun/moon icon and on the check box, which is non obvious. (On the other hand, the commands are not very important!) I would like to add some visual clue, but I haven't come up with a really good - but simple - idea yet.

Phil