Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dynamic Satellite DLL's? (Localization)

iwilld0itiwilld0it Member Posts: 1,134
With VB.NET under Visual Studio's.NET, it is very easy to localize an
application by setting up various .resx files. For instance,
if I wanted my application to default to english yet have german
and french localized versions of the site I just need to create
.resx files named like so (Note the name before the period is the base name and the name after the period is the language code.)

string.resx (Default - English in my case)
string.fr.resx (French neutral)
string.de.resx (German neutral)
string.de-AU.resx (German specicific -- Austria)

Now compliling the application will create my main dll and 3 satellite dll's.

Now hypothetically I have 2 name value pairs in each resource file called ...

WelcomeTitle
WelcomeMessage

and the values correspond to the language.

Now reading from the resource file is easy, just create an instance to a
ResourceManager.

(ResourceTest.aspx.vb)
[code]
Imports System.Resources
Imports System.Threading
Imports System.Globalization

Protected rm As ResourceManager

Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles MyBase.Load

' Use Browsers language setting
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(Request.UserLanguages(0))

' First argument must be base name to resource file
Set rm = new ResourceManager("string", _
GetType(ResourceTest).Assembly)

' Print Values from Resource
Response.Write(rm.GetString("WelcomeTitle") & "
")
Response.Write(rm.GetString("WelcomeMessage") & "
")

End Sub

[/code]

Now i demonstrated reading from the compiled satellite dll's, but I would like to be able to give the administrators of the web-site the ability to change the text on the fly. For instance, maybe choose from a drop-down of languages and then change the welcome title and message for that language. However, there does not seem to be a way to do this
and if it was possible, the satellite dll's would need to be recompiled
on the fly to reflect the changes, unless there is a way to manipulate
the dll's directly.

Any help in this arena would be appreciated.
Sign In or Register to comment.