Nevron Forum

NLocalizationManager how to work with it

https://www.nevron.com/Forum/Topic4945.aspx

By JSW W. - Friday, February 25, 2011

Hi

I read about NLocalizationManager but I am still not so sure what it does.
This is for Nevron internal string only, or can it use for my application e.g. menu localization ?

Could you give example on how can i, translate a menu text or a label text in 3 languages. in your example i did not see how it change any text.

Also can it be use on a website as well as in winform?

Thanks,
By Nevron Support - Tuesday, March 1, 2011

Hello JSW W.,

Basically, NLocalizationManager is a singleton class that collects numbers of NDictionary objects and applies concrete one on certain string properties.

Let say that you have a button which Text property you want to translate on 2 languages.
First you need to create 2 NDictionary objects for each language:

NDictionary nDictionary1 = new NDictionary("nDictionary1");
NDictionary nDictionary2 = new NDictionary("nDictionary2");

Then add record to each one for the button text. First parameter in Add method is the value of key, and the second parameter is the translated value:

nDictionary1.Add("Button 1", "Button on 1st language");
nDictionary1.Add("Button 1", "Button on 2nd language");

Add these dictionaries in the localization manager as follows:
NLocalizationManager.Instance.AddDictionary(nDictionary1);
NLocalizationManager.Instance.AddDictionary(nDictionary2);

Lastly you need to apply the desired dictionary to translate the texts:

Button1.Text = NLocalizationManager.Instance.Translate("Button 1", "nDictionary1");

You can use NLocalizationManager to translate any string property.
To use it you only need to have reference to Nevron.System assembly.

By JSW W. - Wednesday, March 2, 2011

hi
I could right click and see the context menu in different language.

However, I still need example how could i apply for my application for instance to change the text of label control, header table etc.