none
Localized webparts and custom controls - Could not find any resources appropriate for the specified culture or the neutral cultu

    Question

  •  

    Hi,
    I am creating a custom control which will be used in a sharepoint page.
    I am trying to localize the content of that custom control in the code.
    I have added resx files to the class library, Myres.resx and Myres.de-DE.resx.
    I have build the class libary and placed the dll in GAC.
    I am trying to get the resource strings by using the Resource Manager.
    Here is the code:
      string strLanguageCode = Thread.CurrentThread.CurrentCulture.Name;

                    Thread.CurrentThread.CurrentUICulture = new CultureInfo(strLanguageCode.ToString());

                    ResourceManager rm = new ResourceManager("MyRes", System.Reflection.Assembly.Load("MyRes"));
                  
                    result = rm.GetString(resourceKey);

     

    But I am unable to get the code work. And getting the following error.

     

    Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure \"xxxx.Resource.resources\" was correctly embedded or linked into assembly \"xxxx\" at compile time, or that all the satellite assemblies required are loadable and fully signed.

     

    What should be done to make localization to work with class library to be used in sharepoint custom webparts/custom controls.

     

    Thank in Advance,

    mswin

    Friday, September 28, 2007 1:23 PM

All replies

  • have you found a solution already?
    Saturday, October 06, 2007 3:03 PM
  • I had just solve this issue.

    I had been troubled with it for  so  many  days.

    My  problem  solving method below:

    please look at your codes below:

    ResourceManager rm = new ResourceManager("MyRes", System.Reflection.Assembly.Load("MyRes"));
                  
                    result = rm.GetString(resourceKey);

    And make sure that "MyRes" is the name combined with your namespace name and your resource name

    for example:

    your namespace is "W" and your resource name is "Y.resource",

    and now you must name your ResourceManager like this

    ResourceManager rm = new ResourceManager("W.Y", System.Reflection.Assembly);

    now the project will run as usual!

    I solve this error in this way ,and I hope my opinion will help you.

    Thank and best regards

          ----Kevin Wangyy

     

    Moderator Notes:

    1. NEVER propose your own posts as answers. The "Propose as Answer" function is there for people to propose the good answers of other people. NOT for self-proposing.

    2. Do not ask people to contact you by e-mail. Further questions and answers to this subject should be in the thread. NOT off-line.

    3. Do not use Bold throughout most of your posts. Several lines of Bold, removed.

     

     

     

     

     



     

     


    • Proposed as answer by Kevin Wangyy Thursday, April 07, 2011 10:06 AM
    • Unproposed as answer by Mike Walsh FIN Thursday, April 07, 2011 11:01 AM
    • Edited by Mike Walsh FIN Thursday, April 07, 2011 11:04 AM Moderator Notes added about 1. No self-proposing as answer 2. Not asking for questions to be taken off-line 3. over-use of Bold
    Thursday, April 07, 2011 9:57 AM