User-1246604461 posted
I have several local resource files: default.aspx.resx, default.aspx.nl.resx, default.aspx.en.resx
Now when I'm on the Dutch domain the default.aspx.nl.resx is loaded. But now I want to access the value from default.aspx.en.resx and get the English value belonging to name "title".
I can now achieve this by changing the current culture server-side, access the value and then change it back, like so:
Dim culture As CultureInfo = New CultureInfo("en")
Threading.Thread.CurrentThread.CurrentCulture = culture
Threading.Thread.CurrentThread.CurrentUICulture = culture
Dim title as String = GetLocalResourceObject("title")
culture = New CultureInfo("nl")
Threading.Thread.CurrentThread.CurrentCulture = culture
Threading.Thread.CurrentThread.CurrentUICulture = culture
But is there a better/faster way? Preferably without have to change the culture for the current thread, so I can just define which resource file I want to access and in which language?
I saw this link:
http://msdn.microsoft.com/fr-fr/library/ms149953.aspx
I don't see any example here, so I don't know how to use it.
I tried this: GetLocalResourceObject("title", "en"), it doesn't work, since apparently there's no overloaded function like this available.
I'm using ASP.NET 4.5