Open Pmaslo opened 8 years ago
I have exactly the same issue. I'm using the latest version in GitHub. Did somebody find out whether it is possible to confuse a localized solution in the meantime? A localized project like the one above has an additional subfolder 'de' with the file '(AppName).resources.dll' inside. When you analyze the 'Main.Designer.cs' you see that these resources will be loaded at runtime by a call
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
. The resource manager will then look at Thread.CurrentThread.CurrentUICulture to pick the '(AppName).resources.dll' in the corresponding subdirectory. But how does ConfuserEx handle this?
Ok, I could solve that now by looking into the source of ConfuserEx. For those who are interested:
ConfuserEx DOES support localized resources automatically. In the class 'ResourceAnalyzer' it detects whether there are localized resources and adds them to the confused output. You will see a line in the log about that. Don't add reflection attribute for the localized resources dll or you will get a duplicate exception. But if you had localized resources of a dll that you load at runtime you would have to specify their localized resources dll by reflection.
Secondly, be sure not to deploy your localized resources in the setup project, as you would do without ConfuserEx. Remove the entry 'Add localized resources' from the setup project.
Thirdly: Confirm that at the deploy location no subfolder exists with the language code or the ResourceManager in the app will fallback to the default language.
If you do all this you will get a confused localized app.
Does ConfuserEx support localization in Windows Forms Applications? Do I need to enable anything specific in order for the localization to work?
It seems, that after the obfuscation the buttons, menus are always displayed in the Default language.
I have an application that supports a few languages. The Default language works ok, but the rest only work in part.
The part that works ok (for the non-Default languages) is the strings which are being pulled using My.Resources.MyResourceName.MeExampleString
Of course, the same application works properly, before obfuscation.
FWIW, my application changes Culture in the New() constructor of the main class, based on user settings, like this: