PC Review


Reply
Thread Tools Rate Thread

loading the right resources with Satellite Assemblies

 
 
Nader
Guest
Posts: n/a
 
      14th Mar 2007
I have the next simple code and it doesn't work:
ResourceManager gStrings = new ResourceManager("MyApp.Strings",
Assembly.GetExecutingAssembly());

//Get the user's language.
CultureInfo ci = new CultureInfo("es");
String str = gStrings.GetString("Username", ci);

I have two assemblies: one is the fallback String.resx and the other
one is Strings.es.resx
The problem is that str is getting it's string from the fallback and
it just doesn't want to get it from es-assembly
What am I doing wrong??

I would be greatfull if someone helps!

 
Reply With Quote
 
 
 
 
Clive Dixon
Guest
Posts: n/a
 
      15th Mar 2007
I once had a bizarre situation similar to this where I was banging my head
against a wall for ages - it worked for all classes in the system except
one. I tracked it down to a situation where I had an enum defined in the
same source file as the class using the resource manager - as soon as I took
that enum definition out of the same source file it worked. The presence of
the enum class was causing the compiler to generate an incorrect name for
the resource in the satellite assembly (but was correct in the main
assembly, so that fallback worked OK).

1) Where are you deploying your Strings.es.dll assembly? Is it in a
subdirectory called "es" under the directory containing the main assembly?
2) What does the name of the localised resource come out as in the satellite
assembly? (Open up your satellite Strings.es.dll assembly in ildasm.exe,
open up the Manifest section and look at the resource listings of the form
(for example) .mresource public 'Strings.es.resources')


"Nader" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have the next simple code and it doesn't work:
> ResourceManager gStrings = new ResourceManager("MyApp.Strings",
> Assembly.GetExecutingAssembly());
>
> //Get the user's language.
> CultureInfo ci = new CultureInfo("es");
> String str = gStrings.GetString("Username", ci);
>
> I have two assemblies: one is the fallback String.resx and the other
> one is Strings.es.resx
> The problem is that str is getting it's string from the fallback and
> it just doesn't want to get it from es-assembly
> What am I doing wrong??
>
> I would be greatfull if someone helps!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assemblies and satellite assemblies Matze Microsoft C# .NET 0 18th Jun 2008 01:07 PM
Loading resources from satellite assemblies of reflection loaded assemblies.. npthomson@gmail.com Microsoft C# .NET 0 23rd Nov 2006 06:08 PM
Using resources in satellite assemblies with ASP.NET (semi-newbie) =?Utf-8?B?RFQ=?= Microsoft ASP .NET 1 4th Apr 2005 10:34 PM
Dynamically creating satellite assemblies with embedded resources =?Utf-8?B?Tm90cmUgUG91YmVsbGU=?= Microsoft Dot NET Framework 2 10th Sep 2004 11:28 AM
Resource manager load resources from multiple satellite assemblies? Notre Poubelle Microsoft Dot NET Framework 0 21st Jul 2004 10:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:56 PM.