P
Patrick
Hi all,
I have a very strange problem with my resource files. I have build an
applicatie which uses resource files, but for some reason only the default
language works as it should. I use the following code to retrieve resources:
This code is in the TextResource.vb file:
Public Class TextResource
Private objResourceManager As ResourceManager
Public Sub New()
objResourceManager = New ResourceManager(GetType(TextResource))
End Sub
Public Function GetString(ByVal f_strName As String) As String
strResult = objResourceManager.GetString("some key")
Return strResult
End Sub
Public Sub SetUserCulture(ByVal f_strCulture As String)
Dim objCulture As CultureInfo
objCulture = New CultureInfo(f_strCulture)
Threading.Thread.CurrentThread.CurrentCulture = objCulture
Threading.Thread.CurrentThread.CurrentUICulture = objCulture
End Sub
End Class
I have serveral resource files:
TextResource.resx
TextResource.nl.resx
TextResource.de.resx
and so on ...
When i get a string from the resource file it allways returns the string
from the fallback file, even if I explicitly pass then culture to the
resourcemanager.GetString method.
However I have managed to get the it sort of working, when I copy the
compiled resource dll from for instance the /bin/nl directory to the /bin
directory the resources are displayed correctly for the culture 'nl' and
every other culture still returns the fallback. This only allows two culture
and the whole idea behind cultures is to allow as many as needed.
Does anyone have and idea on how to get .net to load the resource files??
Patrick
I have a very strange problem with my resource files. I have build an
applicatie which uses resource files, but for some reason only the default
language works as it should. I use the following code to retrieve resources:
This code is in the TextResource.vb file:
Public Class TextResource
Private objResourceManager As ResourceManager
Public Sub New()
objResourceManager = New ResourceManager(GetType(TextResource))
End Sub
Public Function GetString(ByVal f_strName As String) As String
strResult = objResourceManager.GetString("some key")
Return strResult
End Sub
Public Sub SetUserCulture(ByVal f_strCulture As String)
Dim objCulture As CultureInfo
objCulture = New CultureInfo(f_strCulture)
Threading.Thread.CurrentThread.CurrentCulture = objCulture
Threading.Thread.CurrentThread.CurrentUICulture = objCulture
End Sub
End Class
I have serveral resource files:
TextResource.resx
TextResource.nl.resx
TextResource.de.resx
and so on ...
When i get a string from the resource file it allways returns the string
from the fallback file, even if I explicitly pass then culture to the
resourcemanager.GetString method.
However I have managed to get the it sort of working, when I copy the
compiled resource dll from for instance the /bin/nl directory to the /bin
directory the resources are displayed correctly for the culture 'nl' and
every other culture still returns the fallback. This only allows two culture
and the whole idea behind cultures is to allow as many as needed.
Does anyone have and idea on how to get .net to load the resource files??
Patrick