Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Re: Localization with Satellite Assemblies in VS.


Message #1 by "Colm Hayden" <colm.hayden@r...> on Mon, 3 Sep 2001 10:42:48 +0100
Thanks for the reply Christian.



You were right in thinking that the resource name was causing the problem.

By using ildasm I was quickly able to solve it.



I have 2 related questions that I was hoping someone could answer for me:



1)

If I add images to the satellite assembly, I can read them using

ResourceManager.GetObject(), but how can I display the returned

System.Drawing.Bitmap object as part of an ASPX page.



2)

Is there a performance overhead involved in reading an image from a resource

file and streaming it to the browser for each request. If so, is there a

better way to display localized images? (I have previously used  the

simplistic approach < img

src="Images/<%=CultureInfo.CurrentCulture%>/Logo.jpg" >, but this does not

allow for unsupported cultures to be handled by a default)





All comments welcomed,



    Colm







----- Original Message -----

From: "Christian Nagel" <Christian.Nagel@g...>

To: "ASP+" <aspx@p...>

Sent: Friday, August 31, 2001 8:51 PM

Subject: [aspx] Re: Localization with Satellite Assemblies in VS.





> Hi Colm,

>

> It took me some time to find it out, but this works:

> Build the neutral assembly with the name UIStrings.dll and put it into the

> bin directory.

> The French satellite assembly must be named UIStrings.resources.dll and

put

> into the fr directory (do it similar with the other languages). The French

> satellite assembly must be built with the al option /culture:fr.

>

> Using Visual Studio .NET all you have to do is add the binary resource

files

> to the project. The build action of these files is automatically set to

> Embedded Resource. For the resource manager use

> Assembly.GetExecutingAssembly() to get to the resource. Pay attention to

the

> resource name needed for the ResourceManager. The namespace of the project

> is added, but don't add the resources extension. You can get the resource

> name by looking into the manifest using ildasm.

>

> I hope this helps.

>

> Best regards,

> Christian

> http://christian.nagel.net

> Professional C#

>

>

> ----- Original Message -----

> From: "Colm Hayden" <colm.hayden@r...>

> To: "ASP+" <aspx@p...>

> Sent: Friday, August 31, 2001 7:12 PM

> Subject: [aspx] Localization with Satellite Assemblies in VS.

>

>

> Hi,

>

> I have been attempting to build a localized web application and have

> been having trouble using satellite assemblies in Visual Studio

>

> Following the Quickstart examples and Framework SDK tutorial I have been

> able to create .resources files and access these using

> ResourceManager.CreateFileBasedResourceManager().

>

> I have no problems reading localised strings from the .resources files.

>

>

> However, I would like to use satellite assemblies to avoid file locking,

> etc.

> I would like to be able to do my final build from Visual Studio, but do

> not know how to reference the assemblies

>

> What I have tried:

> 1 Command-line & VS

> 1-1. created .resource files and built assemblies placing the assemblies

> in the appropriate directories

> e.g.

>     resgen UIStrings.fr-fr.txt UIStrings.fr-fr.resources

>     al /out:..\bin\fr-fr\UIStrings.Resources.DLL /c:fr-fr

> /embed:UIStrings.fr-fr.resources, UIStrings.fr-fr.resources, Private

>

> resulting in

> WebDir/

>             bin/

>                 UIStrings.resources.dll

>                 fr-fr/

>                     UIStrings.fr-fr.resources.dll

>

> 1-2. Built the web application as normal

>

> 2 VS Only

> 2.1 - added the .resources files to the WebProject in Solution Explorer

> 2.2 - built the web app as normal (this seems to add the DLLs to the

> appropriate directories (eg. bin/fr-fr))

>

>

> Please can anyone help me, as I cannot find much info on how to do all

> this inside Visual Studio

>

>

> Thanks in advance,

>                         Colm

  Return to Index