This project is read-only.


Jan 13, 2010 at 1:36 PM

I can't express enough how grateful I am for your Addin!

I have a few suggestions to make it even better.

1) It would be great if I could choose where to put all the .Resx files, instead of being stuck with automatically generated folder App_Resources. I want to put all the .Resx files in some assembly where resides all my resources, because all my projects have resources in that dll.

You can just put some sort of checkbox to mark that I want to put all of it in differnet folder and some simple browse button. It would be great if you could also save the last folder where I have been, so I would not have to go trough all the browsing of a folder.

2) If I localize with Method by code, and then make a translation of a given Resx file, for example Shell.xaml.Resx, and then make, everything Is fine. Now, if I decide to add new MenuItem with some Header in Shell.xaml, and run your Addin, that Header is automatically added to the Shell.xaml.Resx which is great, but is not added to I recommend to add it to all Resx files that represents the translations of the default Resx file.

3) I localize with Method by code, and got Resx file successfully. Now, if I change the text in some Header or content or whatever, this change needs to be synchronized with the original and all the translated Resx files. I propose to just override the original values in the default Resx file as well in all translated Resx file with this new value. Then give the user a chance to somehow see and save all the information about synchronization, where he could see what changes has been made to what Resx file. This information would be of great help to the translator (person who translates this Resx files).

4) If I localize with Method by code, there is this Translate method in translat.cs behind code file  which is all great. Now, If I want to add my custom Translation, lets say FlowDirection for window, I have to return Enum and not string, which forces me to add Flow key in Resx file and Value, for example, Flow = LeftToRight. Now, I would have something like this in my translate method:


this.FlowDirection = (System.Windows.FlowDirection)Enum.Parse(typeof(System.Windows.FlowDirection), resourceManager.GetString("Flow"))

The problem is, that this custom translation is get deleted when I run the Addin again. It would be great if you could make some other behind code file that would be generated only the first time, not if it's already there, so I could add my custom translations to this file.

For example, I have Shell.xaml, Shell.xaml.cs and with your addin I would have two more files. Shell.xaml.translat.cs and Shell.xaml.customtranslat.cs. In this second file there would be a method CustomTranslate which is alway called from Translate method;

Now I could edit this method, CustomTranslate, and not wory of being overwritten when I run your Addin again. There would not have to be custom file, just this one method that is not overwritten. But I bet that the It's easier for you to make second behind code file that is only generated once and not being overwritten if it exists.


Jan 14, 2010 at 1:40 PM

1) There is some problems :

- the namespace (but i can ask for that)

- the project. For now, i add resx file to the project, if i put resx in folder, people need to add manually to a project, or i need to list all projects in solution (it resolves the problem of namespace).

- The code for resourceManager (we need to create 2 code file, one for partial class of UserControl/Windows, one for resource)  (but it exists custom tool to generate public resource manager).

- Need to add reference to the assembly

2) Personnaly i use translation tools, translation tools take care of that (it explains too why i have no problem with 1 because it takes all resx files from all project).

Not complex to implement, but the problem to add for example header in, there is a risk "to forget" to translate too, or we have to add some prefix to the text.

3) The problem does not appear with translation tools, because these programs track changement in the default resx file. Override the original value in other language is somewhat risky (for example, your correct an error, and where to save the old translation ?).

An alternative is to log these modications (it can help the point 2 too).

4) I do not understand.

You can create your own method in Shell.xaml.cs (why Shell.xaml.customtranslat.cs ?) and then call Translate().

> this custom translation is get deleted

Normally, the content of resX file is incremented, thus if you add other strings in resx file, they are not deleted. If not => it is a bug.

After a third read, i understand that you want add some template code to all class. But i do not understand why, you can write a global method that take the window/usercontrol and the resourceManager as parameters, and you call these method after/before you call Translate. It is more "maintenable".



Use a translation tools can help a bit (but i understand that the licence price by head is often "zinzin", i never search for open solution because in my company, we choose a commercial solution ;) ). I create these tools because even in commercial solution, there is no good method to translate xaml file (some have baml support but only for WPF and it is awfull !). These tools track for changement and generate cleaned translated resx file (and the satellite assemblies).
I will keep these approach.

Logging of what is changed/added will be helpfull, i propose to add this functionality.

Centralisation of resX files is a good idea. The problem is the the tools is not really "next => next => compile => run". I can modify the generation and add manual steps because all automatic will be a lot of work but why not. I think i need a blog to add explanations ! ;)

I have no time this week, but the next week end, i have some time.