SilverlightShow: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples en-us SilverlightShow.net estoychev@completit.com (Emil Stoychev) Argotic Syndication Framework, http://www.codeplex.com/Argotic http://www.rssboard.org/rss-specification RE: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx#comment3570 <p>I think you could do it by having a method like this, and calling it when they do something...like selecting a different language from a dropdown.</p> <p> </p> <p>        private static void ShowGerman()<br />         {<br />             var cultureInfo = new CultureInfo("de");<br />             Thread.CurrentThread.CurrentCulture = cultureInfo;<br />             Thread.CurrentThread.CurrentUICulture = cultureInfo;<br />         }</p> ( Ross) http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx Mon, 10 May 2010 17:06:34 +0300 RE: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx#comment3568 <p>Coming from a Windows Forms I18N/I10N background, this is the information I was looking for now that I am starting on SilverLight.  Thank you for the information.</p> <p>I would like to use the browser language setting to change the resource file so I guess I should pass the language parameter to App.xaml.cs.  How about if I allow the user to switch language mid-way?  How can I change the thread culture?</p> ( K.Kong) http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx Mon, 10 May 2010 12:16:34 +0300 RE: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx#comment3163 I have finished playing with your sample including adding some tweaks like dynamic switching between locales. In the process I have learned some cool stuff I never used before. <div><br /> </div> <div>There appears to be an error/omission in your steps above. I found that the changes you describe in steps 36 and 37 had to be made to Mainpage.xaml rather than MyView.xaml, and that some markup has to be added to MyView.xaml that displays the resource strings by binding to the properties exposed by MyViewModel.cs. Without these changes the project runs but no text is displayed.</div> <div><br /> </div> <div>Should anyone be interested in viewing the solution with my tweaks, the source can be found <a href="http://www.box.net/shared/t1j52er7ar">here</a>.</div> ( Steve Crane) http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx Wed, 03 Mar 2010 11:56:46 +0300 RE: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx#comment3162 Glad to hear it Steve. ( Ross) http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx Wed, 03 Mar 2010 10:12:12 +0300 RE: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx#comment3161 I just deleted all the .resx files and re-created them. I'm pretty sure that I didn't do anything differently yet this time there is a MyStrings.Designer.cs that wasn't there the first time round. And of course that solves the problem. ( Steve Crane) http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx Wed, 03 Mar 2010 08:47:01 +0300 RE: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx#comment3144 Hmm, trying adding MyStrings.resx under Assets/Resources (make sure you select Resources File from the Add New Item dialog). You should then be able to expand the arrow next to MyStrings.resx and see MyStrings.Designer.cs. If you open this file its namespace should be InternationalizationApp1.Assets.Resources, which should match up with the using statement you added to your view model class. ( Ross) http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx Tue, 02 Mar 2010 17:36:41 +0300 RE: Internationalization/Globalization in Silverlight - Part 5 - MVVM Approach http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx#comment3143 Nice article. We use a different method of languaging applications that is not resource-based or locale-dependent so I have not done it the resource way before. <div><br /> </div> <div>I have encountered a problem following this in VS2008. The using InternationalizationApp1.Assets.Resources shows an error unless I place an empty .cs file in the Resources folder and even then the MyStrings references show errors of not existing in the current context. I need to head off home now but will continue later this evening or in the morning. Should you see this before then and offer a solution, that would be great.</div> ( Steve Crane) http://www.silverlightshow.net/items/Internationalization-Globalization-in-Silverlight-Part-5-MVVM-Approach.aspx Tue, 02 Mar 2010 17:20:37 +0300