How can I detect resource fallback?

Comanche

Newcomer
Joined
May 26, 2006
Messages
6
Imagine that there's no german-language satellite library for our application, and that we execute the following:

Code:
My.Application.ChangeUICulture("de-DE")
VB will just fallback to the neutral culture (e.g. "en-US") - and no any exception will be thrown! Besides, if we then execute the following line of code:

Code:
MsgBox(My.Application.UICulture)
- we'll see "de-DE", although our GUI will be seen in American English!

I can't find a way to detect that this resource fallback happens. I need that because it'll be nice to react by requesting the missing satellite DLL from my application server, instead of silently switching to the neutral culture.

Any ideas?
 
You could check for the satellite DLL manually and do the the download if necesary before you make the call the ChangeUICulture instead of waiting for an exception that never comes..
 
Thanks, guys. I just found similar solution (after several hours in MSDN :)):
Code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  Dim rm As New System.Resources.ResourceManager(Me.GetType)
  Dim ci As New System.Globalization.CultureInfo("de-DE")
  Dim rt As System.Resources.ResourceSet = rm.GetResourceSet(ci, False, False)
  If rt Is Nothing Then
	MsgBox("Could not find satellite assembly for UICulture = de-DE")
  End If
  rt.Dispose()
End Sub
 
Back
Top