Questions about move to resources

May 7, 2013 at 5:04 PM
Edited May 7, 2013 at 5:06 PM
In Move to resources window:
  1. How can select a destination file that is in another project ? (very important for me!)
  2. Check item is very uncomfortable: as i click the checkbox, item is selected, row height is modified and i have to click once again to check it. I don't like simple click expand row height, should be done by double clicking or another way.
  3. Multiple checking is uncomfortable (see previous)
  4. Windows form designer file: as I Execute Move to resource i have noticed that strings are replaced with corresponding property of resource file. As i change something in the form everything is rolled back. Is there a way to solve it? Or to disable it? Or to have every replaced assignment in a separate window so I can copy code in the form load event? (very important for me!)
Coordinator
May 7, 2013 at 5:51 PM
Hi PaoloF,

many of your questions stem from the fact that I did not yet have time to create a satisfactory documentation. Hopefuly, it will get better.
How can select a destination file that is in another project ? (very important for me!)
Visual Localizer lists all possible destination resource files, i.e. those that have designer files generated, are not locked nor readonly etc. If you want to add a resource to a resource file in another project, that project must be referenced (included in the References folder). Otherwise the newly created reference would cause a compile error. If your desired file is not listed, please include more information about your project and I will attempt to re-create the issue.
Check item is very uncomfortable: as i click the checkbox, item is selected, row height is modified and i have to click once again to check it. I don't like simple click expand row height, should be done by double clicking or another way.
The row is expanded because of the Context column, which contains several lines of code around the string literal. You can disable the context column (and therefore the row expansion) in the Tools/Options/Visual Localizer/Filter ToolWindows options page.
Also, you can select multiple rows in the grid and invoke context menu, which contains option to un-check all selected rows.
Windows form designer file...
This is a natural behavior of windows forms designer - its resource file is regenerated whenever a change is made. Basically, you should not use these files to add your own data - the default Visual Studio editor even displays warning when something like this is performed. Use separate resource files to store your own resources and let the forms designer have its own.

Hope it helps, if not - keep asking :-)
May 10, 2013 at 9:20 AM
Edited May 10, 2013 at 9:32 AM
Hi,
Visual Localizer lists all possible destination resource files, i.e. those that have designer files generated, are not locked nor readonly etc. If you want to add a resource to a resource file in another project, that project must be referenced (included in the References folder). Otherwise the newly created reference would cause a compile error. If your desired file is not listed, please include more information about your project and I will attempt to re-create the issue.
I've found the problem: In VB when i add a resource file it is added in My.Resources Namespace, i removed the namespace, because in my code i want to write:
Me.Text = ClassLibrary1.resTraduzioni.Title
instead of
Me.Text = ClassLibrary1.My.Resources.resTraduzioni.Title
After removing namespace VL does not see anymore the resource file. also it makes reference count to not work.
The row is expanded because of the Context column, which contains several lines of code around the string literal. You can disable the context column (and therefore the row expansion) in the Tools/Options/Visual Localizer/Filter ToolWindows options page.
Also, you can select multiple rows in the grid and invoke context menu, which contains option to un-check all selected rows.
Sorry, still think it's uncomfortable :)
I need context column cannot remove it,
When i use context menu to check rows, if there are 4 rows selected, only 3 are checked.
This is a natural behavior of windows forms designer - its resource file is regenerated whenever a change is made. Basically, you should not use these files to add your own data - the default Visual Studio editor even displays warning when something like this is performed. Use separate resource files to store your own resources and let the forms designer have its own.
Ok, i'm using a single resource file not one for each form.
Wich approach do you suggest? Maybe i'im missing something..
Can i disable VL by replacing string in designer file and having VL only to extract string for these files?
Would be great to have every replaced assignment in a separate window so I can copy code in the form load event. In form load event I assign text eg to labels taking translation from resource file. This is taking me a very long time. Hope i have explained..

One more thing: Can i disable VL resource editor?
Coordinator
May 10, 2013 at 9:46 AM
Hi PaoloF,

to be honest, I have slightly trouble understanding what you're saying :-).

I am not sure what you mean by "i removed the namespace...".
I have just tried it out and
Me.Text = ClassLibrary1.resTraduzioni.Title
leads to a compiler error, assuming ClassLibrary1 is a namespace in a referenced project. If the compiler cannot do it, neither can Visual Localizer :-).

Now, the "batch move" tool grid - the fact that only 3 out of 4 rows are un-checked seems like I bug, I will fix it. To make sure it does not happen, select different column in the grid, i.e. make sure not "checkbox cell" is selected when the context menu is invoked. This is caused by rather weird DataGridView approach to editing values in cells.
Can i disable VL by replacing string in designer file and having VL only to extract string for these files? Would be great to have every replaced assignment in a separate window so I can copy code in the form load event. In form load event I assign text eg to labels taking translation from resource file. This is taking me a very long time. Hope i have explained..
I am afraid I don't understand... What string do you want to replace...? If you do not want Visual Localizer to open resource files, use different editor - in the Solution Explorer, right-click the file and select "Open with...". The default is "Managed resources editor".
May 10, 2013 at 10:11 AM
Edited May 10, 2013 at 10:18 AM
to be honest, I have slightly trouble understanding what you're saying :-).

I am not sure what you mean by "i removed the namespace...".
I have just tried it out and
Me.Text = ClassLibrary1.resTraduzioni.Title
leads to a compiler error, assuming ClassLibrary1 is a namespace in a referenced project. If the compiler cannot do it, neither can Visual Localizer :-).
I changed resource class designer from
Namespace My.Resources
    Public Class resTraduzioni
    End Class
End Namespace
To
    Public Class resTraduzioni
    End Class
'Removing' the namespace. :)
This can be done also using property window of resource.
Now, the "batch move" tool grid - the fact that only 3 out of 4 rows are un-checked seems like I bug, I will fix it. To make sure it does not happen, select different column in the grid, i.e. make sure not "checkbox cell" is selected when the context menu is invoked. This is caused by rather weird DataGridView approach to editing values in cells.
OK :)
Can i disable VL by replacing string in designer file and having VL only to extract string for these files? Would be great to have every replaced assignment in a separate window so I can copy code in the form load event. In form load event I assign text eg to labels taking translation from resource file. This is taking me a very long time. Hope i have explained..
I am afraid I don't understand... What string do you want to replace...?
If form load event, i have to write something like:
Me.Text = ClassLibrary1.resTraduzioni.Title
Label1.Text = ClassLibrary1.resTraduzioni.Form1_Label1
....
This is something like what VL do in designer class, but it will be lost because of behavior of windows forms designer.
Would be great if VL generates above code somewhere so i can paste it in Form Load event. I have to manually write above code...
Hope I explained clearer now.
If you do not want Visual Localizer to open resource files, use different editor - in the Solution Explorer, right-click the file and select "Open with...". The default is "Managed resources editor".
OK, thank you.
Coordinator
May 10, 2013 at 10:32 AM
Ok, NOW I get it :-).

The namespace removal you did causes the error. I primarily developed this for C#, which has slightly different behavior in this aspect - I managed to recreate the issue and will update the release soon. Thank you very much for pointing it out.
Btw, it is recommended to do this in the Properties Window - the "Custom tool namespace" is exactly what you need to modify.

Why do you have your Form_load event in the designer file? If course, the designer file is regenerated very often, after every change in the GUI. You should not place ANY code in there. If you right-click on the Form in the Solution Explorer and select "View Code", the Form.vb file will be opened and this is not regenerated. You can therefore place there any code you want without risking its loss.
May 10, 2013 at 10:47 AM
Why do you have your Form_load event in the designer file? If course, the designer file is regenerated very often, after every change in the GUI. You should not place ANY code in there. If you right-click on the Form in the Solution Explorer and select "View Code", the Form.vb file will be opened and this is not regenerated. You can therefore place there any code you want without risking its loss.
Maybe i explained wrongly i have Form_Load in the separate Form.vb file.
But i have to write manually the code i've showed you in form load event (eg. all assignments like Label1.Text = ClassLibrary1.resTraduzioni.Form1_Label1).
VL when extracts string from designer, can produce automatically the code i should write manually in form load.
Got it?

Please inform me if you deploy a new version.
Thank you
Coordinator
May 10, 2013 at 10:57 AM
Ok, I got it - there is no such feature in Visual Localizer now. Since this is task that must be done only once during the development, I don't think of it as a big issue. I will put this in the "Possible future implementations" section. If you weren't localizing the project, you would be doing the same amount of work, only initializing the properties with string literals, not references to a designer file.
May 10, 2013 at 11:16 AM
Ok, well it will be incredibly useful for people like me that have big solutions not localized that need to be localized.
The biggest solution i have has 250 forms and many of them have many controls. (some have 500 controls).
Thank you!
Coordinator
May 10, 2013 at 11:29 AM
I just updated the release. It would help me a lot if you tried it out and let me know if everything is OK. I fixed the un-checking issue and the custom namespace issue.
For future reference - if you want to be informed about updates in this project, please hit the "Follow" link on the project homepage.
May 10, 2013 at 11:42 AM
I will let you know on Monday. :)
May 13, 2013 at 8:42 AM
Hi,
I've just tryed and it works.

2 Little things:
  1. In control panel installed programs i see version is still 1.3.0
  2. In home page release date is still 19 April
Coordinator
May 13, 2013 at 8:47 AM
Hi, thank you very much for the update.
I obviously forgot to update the information in the installer, that's what you see in the control panel.
The release date on the project homepage remains the same, it's the 'updated at' value that changes (until the next release).

Hope you enjoy Visual Localizer, any more comments or issues are welcome :-)