1. Open Visual Studio
2. Click File \ New Project...
3. Select Visual C# \ Silverlight \ Silverlight Application
4. In the name field type TestProj
5. Click ok and ok
6. In the Project Explorer
7. Right click on the TestProj (c# Icon) Project
8. Click Add \ New Folder
9. Name it Resources
10. Right click on Resources folder and click add New Item...
11. Select Resources File
12. Name it MyResource.resx and click ok
13. Open the new created MyResource.resx
14. In the Access Modifier: dropdown select Public
15. In the Name Field type tb1 and value “tb1 in english”
16. Repeat with Name Field type tb2 and value “tb2 in english”
17. In the file MyResource.Designer.cs change “internal MyResource() {“ to “public MyResource() {”
18. Click Save, press F5 and add debugging to web.config
19. IE opens up with a blank page
20. Close IE
21. Open Page.xaml in xaml editor window
22. In the user control add a new xml namespace xmlns:Loc="clr-namespace:TestProj.Resources"
23. Add a locstrings as a resource to your page eg:
24. Inside the grid add a Textblock and bind it to your resource Tb1 eg:
25. The String should appear in the Design view above
26. Wrap the textblock inside a vertical stackpanel and add a second Textkblock
27. In Project Explorer right click on MyResource.resx and copy and paste it into the resources folder
28. Rename “Copy of MyResource.resx” to “MyResource.de.resx” (DE is the two letter language code for Duetch)
29. Open MyResource.de.resx Edit the value to “tb1 auf deutsch” and “tb2 auf deutsch”
30. repeat step 28 for creating resource in fr, nl (you can add any no of copies depends upon ur requirement).
So we have 4 resource files(since i created resource files for de, fr and nl)
1. MyResource.resx
2. MyResource.de.resx
3. MyResource.fr.resx
4. MyResource.nl.resx
30. Click Save, press F5
31. Notice the files \\bin\debug\de\MyResource.resources.dll
\\bin\debug\fr\MyResource.resources.dll
\\bin\debug\nl\MyResource.resources.dll
32. right click on project and select Properties
33. select build events, in post-build event command line, copy paste following
xcopy /SY "$(TargetDir)de" "$(SolutionDir)$(ProjectName)Web\ClientBin\de\"
xcopy /SY "$(TargetDir)fr" "$(SolutionDir)$(ProjectName)Web\ClientBin\fr\"
xcopy /SY "$(TargetDir)nl" "$(SolutionDir)$(ProjectName)Web\ClientBin\nl\"
34. Compile
35. refresh bin/debug folder
36. check wether bellow files are shown
MyResource.resources.de.dll
MyResource.resources.fr.dll
MyResource.resources.nl.dll
if any of the file is missing, suppose if MyResource.resources.nl.dll is not shown, then go to \\bin\debug\nl folder, copy n paste testproj.resources.dll, and rename it MyResource.resources.nl.dll move this file to \\bin\debug folder
37 Compile and execute.
38. open Page.xaml.cs file
write in
page_load()
{
//textbox uses resource of deutch,
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de"); }
39 Compile and execute.