A newbie's question on localization

I tried to created a localizable click once application. It finally worked out with double resx files (one for greek one for english and a default).
The runtime seems to be able to see the correct language from the resource files. But I cannot access them programmatically.

I try to do the following:
ResourceManager resources = new ResourceManager("TecGoblinUtilities", System.Reflection.Assembly.GetExecutingAssembly());

            this.btExec.Text = resources.GetString("btExec.Text");

(I want a button to have its text changed depending on the current mode)

Well, I get a MissingManifestResourceException
I checked my bins, and the resource files were created correctly: I have one folder for each language, and in each one there is a TecGoblinUtilities.resources.dll

What is going wrong Any help please...



Answer this question

A newbie's question on localization

  • ferrethouse

    tec-goblin:

    Are you following the instructions for creating a localized satellite assembly for the second language Here is a good starting point:

    http://msdn2.microsoft.com/en-us/library/f45fce5x.aspx

    Michael Blome - Visual C# Documentation Team

     


  • Hensen

    I had already read it... finally the answer was to use:
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));

    instead of a general ResourceManager (I saw the generated code to find the answer)


  • Nigel Richardson

    I was going through your article on usage of satellite assemblies but was not able to use my resource file successfully.

    I have got three files in a folder named fr-CA in application’s bin/debug folder namely:

    ***resx file strings.fr-CA

    ***resources file MyResources.fr-CA.resources

    ***satellite assembly MindSpring.resources.dll

    And the code snippet I am using is:

    CultureInfo ci=new CultureInfo("fr-CA");

    Thread.CurrentThread.CurrentCulture=ci;

    Thread.CurrentThread.CurrentUICulture=new CultureInfo("fr-CA");

    ResourceManager resMgr=new ResourceManager("MindSpring",Assembly.GetExecutingAssembly().GetSatelliteAssembly(ci));

    columnHeader1.Text=resMgr.GetString("columnHeader1");

    I am getting the exception:

    Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "MindSpring.resources" was correctly embedded or linked into assembly "MindSpring.resources".

    baseName: MindSpring locationInfo: <null> resource file name: MindSpring.resources assembly: MindSpring.resources, Version=1.0.2247.23662, Culture=fr-CA, PublicKeyToken=null

    Can you please guide me on what went wrong


  • martin.kolarik

    System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
    I used this instead of a ResourceManager - so it checked automatically the resx files associated with my frmMain (of course you'll have differently named your form).
    It isn't extremely cute, but it worked finally


  • A newbie's question on localization