Resource manager problem: naming for embedded resource.

Discussion in 'ASP .Net' started by Dirc Khan-Evans, Oct 17, 2005.

  1. I am trying to localise my app using embedded resource
    and sattellite assemblies.

    I can get it working using the following if I have a resource
    file with the same name as the class:

    ResourceManager resourceManager =
    new ResourceManager(this.GetType());

    However, I want to use a global resource for my assembly.
    I have tried using the following with a resource file called
    Strings.resx:

    ResourceManager resourceManager =
    new ResourceManager("Strings", this.GetType().Assembly);

    I have also messed around setting the Custom Tool Namespace
    but cannot get this working either.

    As far as I can tell I am following the documentation, but
    I can't get this to work.... I know it's going to be a
    simple answer.. so could someone please put me out of my misery!

    I'm certain it's down to the naming convention used but I don't get it
    from the documentation.


    Thanks in advance

    Dirc

    --
    Dirc Khan-Evans, Oct 17, 2005
    #1
    1. Advertising

  2. Dirc Khan-Evans

    Karl Seguin Guest

    it should be NAMESPACE.Strings

    so if the default namespace of your c# project is MyWebApp

    it should be "MyWebApp.Strings"

    to get the currently assembly, you should also do
    System.Reflection.Assembly.GetExecutingAssembly

    To find out the default namspace, right click on the project and goto
    properties..it's in the first tab I think.

    If you want a different (and better) way to deal with localized content,
    check out:
    http://openmymind.net/index.aspx?documentId=3
    http://openmymind.net/index.aspx?documentId=4

    and there's a part 3 coming soon :)

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/
    "Dirc Khan-Evans" <> wrote in message
    news:%...
    >
    > I am trying to localise my app using embedded resource
    > and sattellite assemblies.
    >
    > I can get it working using the following if I have a resource
    > file with the same name as the class:
    >
    > ResourceManager resourceManager =
    > new ResourceManager(this.GetType());
    >
    > However, I want to use a global resource for my assembly.
    > I have tried using the following with a resource file called
    > Strings.resx:
    >
    > ResourceManager resourceManager =
    > new ResourceManager("Strings", this.GetType().Assembly);
    >
    > I have also messed around setting the Custom Tool Namespace
    > but cannot get this working either.
    >
    > As far as I can tell I am following the documentation, but
    > I can't get this to work.... I know it's going to be a
    > simple answer.. so could someone please put me out of my misery!
    >
    > I'm certain it's down to the naming convention used but I don't get it
    > from the documentation.
    >
    >
    > Thanks in advance
    >
    > Dirc
    >
    > --
    >
    Karl Seguin, Oct 17, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miguel Dias Moura

    AspNet 2.0 Resource file naming problem.

    Miguel Dias Moura, Feb 1, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    398
    Miguel Dias Moura
    Feb 1, 2006
  2. Harman
    Replies:
    1
    Views:
    2,501
    Moiristo
    Jul 28, 2006
  3. padma
    Replies:
    0
    Views:
    347
    padma
    Oct 3, 2007
  4. Metalone
    Replies:
    0
    Views:
    343
    Metalone
    Jan 6, 2010
  5. Tomasz Koziara

    naming the main module in embedded Python

    Tomasz Koziara, Sep 21, 2010, in forum: Python
    Replies:
    0
    Views:
    223
    Tomasz Koziara
    Sep 21, 2010
Loading...

Share This Page