NLS support for WinForm

Posted on 2005-05-02
Last Modified: 2010-04-16

I have a windows form based appln in c#. I want to provide NLS support. So in the gui designer I change the "language" property to reflect the lang i want and now i have the diff resource.dll in diff lang folders (fr, ru).
The problem is I want to add some string myself, like the error strings, but when i manually try to add to the .resx files and when i reopen the gui, or if i make any modfn to the gui, these strings disappear!

Any idea?
Question by:kunjachan_
    LVL 96

    Expert Comment

    by:Bob Learned
    These are some of the URLs that I have to help explain localization in C#:

    Creating and Using Resources:

    Using Resource-only Assemblies with C#:

    The Mystery of Windows Resource Solved:

    Generated Access to .NET Resource Strings:


    Author Comment

    thnx for the urls. but none of them says how to add manually some strings into the .resx files created during the winform design.
    LVL 4

    Accepted Solution

    You can create your own Resource files are read from that

    Goto Project properties and "Add New Item" from that choose "Assembly Resource File"

    I created a new file called Resource1.resx Using VS.NET. In the data section added one member "Nachi"  and value as u like. and used below code for getting the string. After this is done only thing u need to do is to create many files for different culture of resource1.

    IMP: remember your base name in ResourceManager constructor will be WindowsApplication1.Resource1 not only Resource1!!!

                      ResourceManager rm = new ResourceManager("WindowsApplication1.Resource1",Assembly.GetExecutingAssembly());
                      MessageBox.Show( rm.GetString("Nachi",System.Threading.Thread.CurrentThread.CurrentCulture));

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now