HorridoJoho Posted January 16, 2014 Share Posted January 16, 2014 (edited) Ok, now i made my first plugin with buildin english language an created a resource for german translation. Now the problem i'm facing is, the CurrentUICulture is inconsistent between callbacks. While in the Constructor, OnCreatePropertyCollection & OnCreateConfigUI, the CurrentUICulture is set as the language i selected in PDN, in the OnSetRenderInfo, the CurrentUICulture is set to my operating system settings. The consequences with an example: The plugin has:Buildin english language. External resource dll for german language. Operating system regional settings: German PDN Language settings: English The problem:The constructor uses Properties.Resources with the CurrentUICulure set by PDN(English in this case, resource lookups will choose buildin resources which are in enlgish) In OnCreatePropertyCollection properties are created with the names from Properties.Resources. In OnCreateConfigUI, everything is fine since the CurrentUICulture is still the one set by PDN. In OnSetRenderInfo i want to retrive the properties created in OnCreatePropertyCollection. But for this thread, the CurrentUICulture is set to my operating system regional settings(in this case german). This leads me to a NullPointerException, because the PropertyCollection which is passed to OnSetRenderInfo was created with names in english language, and now i try to retrive the properties by german name which do not exist. Workaround: Set the Culture of your resource to System.Globalization.CultureInfo.CurrentUICulture in your effect plugin constructor. Fix: PDN must set the CurrentUICulture of the curren thread to it's own setting. Edited January 16, 2014 by HorridoJoho Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted January 19, 2014 Share Posted January 19, 2014 I think there's a thing in .NET 4.0/4.5 that I can use so that this isn't even a concern. It lets you set the default CultureInfo for all threads. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Rick Brewster Posted February 10, 2014 Share Posted February 10, 2014 BTW this should now be fixed in the latest paint.net 4.0 stuff. All threads should see the correct CultureInfo.CurrentUICulture value. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
HorridoJoho Posted February 13, 2014 Author Share Posted February 13, 2014 Yeah, i noticed it on the chanagelog of the PDN 4 alpha update, thanks. As soon as PDN 4 is final i guess there is no reason anymore to apply the workaround. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.