Geeks With Blogs
Jeroen Bourdeaud'hui web application developer
If you have a website with many languages, you don't want to edit the resource files every time the client asks for a change.
So you can create an application, where you or your client can edit the resource files.

First you have to read all the resource files into your database. For this, you need the ResXResourceReader.
Dim resXFileRead As String = "D:\\vs2008\\test\\ResxFileGenerator\\test.resx"
Using reader As New ResXResourceReader(resXFileRead)
For Each d As DictionaryEntry In reader
Response.Write("Key: " & d.Key & " --- " & "Value: " & d.Value)
Next
End Using


After you've written the code, for inserting the current resource files into your database, you have to create a backend for managing these resource files.
Create a new resource file, create a new label, translate a label to the languages you support in your website, adding a translation tool like Google AJAX Language and so on.

At the end, you want to publish your edited resource files.
Get the resource values from your database and add them to the resource file.

Dim resXFile As String = "D:\\vs2008\\test\\ResxFileGenerator\\test.resx"
Dim fs As New FileStream(resXFile, FileMode.Create)

Using writer As New ResXResourceWriter(fs)
    For i As Integer = 0 To 10
        writer.AddResource("Name" + i.ToString, "Value" + i.ToString)
    Next
End Using



More info:
http://msdn.microsoft.com/en-us/library/system.resources.resxresourcereader.aspx
http://msdn.microsoft.com/en-us/library/system.resources.resxresourcewriter.aspx Posted on Sunday, April 19, 2009 11:50 AM asp.net | Back to top


Comments on this post: Creating Resource Files Programmatically

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Jeroen Bourdeaud'hui | Powered by: GeeksWithBlogs.net