Nevron Open Vision Documentation
Localization Dictionaries

All localization requests of Nevron Open Vision based applications are handled by the single instance of the NLocalizationDictionary singleton class available through its Instance static read only field.

Localization Dictionaries

The localization dictionary is a data structure used to store and obtain translations of strings. A localization dictionary contains a map of keys and their translations. The NLocalizationDictionary class provides the following properties:

NOV provides a single instance of the NLocalizationDictaionary class accessible through the static readonly Instance field. To set the translation of a given key, you can use the SetTranslation method of the dictionary. For example, the code below sets a German translation to the text "Cancel".

Set a term translation
Copy Code
NLocalizationDictionary.Instance.SetTranslation("Cancel", "Abbrechen");

To get the translation of a given key you can use the NLoc.Get shortcut method like this:

Get a term translation
Copy Code
string localizedString = NLoc.Get("Cancel");

The NLoc.Get method returns the translation of the given key or the key itself if a translation for it is not found in the dictionary.

Alternatively to get the translation of a given key, you can use the TryGetTranslation method of the localization dictionary. This method returns true if a translation of the given key is found in the dictionary and false otherwise. The translation itself is returned as an out parameter.

If you are writing an application that should be localized to different languages, you should encapsulate all string literals subject to localization in NLoc.Get() calls as shown in the example above.
Loading, Editing and Saving Dictionaries

Nevron localization dictionaries can be loaded from and saved to TMX (translation memory exchange format). To load and save dictionaries, use the LoadFromStream and SaveToStream methods of the localization dictionary.

The following code shows how to load a Nevron Localization dictionary from file:

Load Localization Dictionary
Copy Code
using (Stream stream = File.OpenRead(@"C:\MyApp\Languages\NovDictionary_de-DE.tmx"))

Note that NLocalizationDictionary.Instance.LoadFromStream just loads the localization dictionary strings and doesn't honor its font settings. If want to apply the dictionary font settings, too, pass the localization dictionary stream to NApplication.LocalizeFromStream. For more information open the Localizing Applications topic.

Similarly you can save a dictionary to a file:

Save Localization Dictionary
Copy Code
using (Stream stream = File.Create(@"C:\MyApp\Languages\NovDictionary_de-DE.tmx"))

Nevron provides a dictionary editor application, which can be used to import all localizable strings from one or more C# solutions, projects or source code files, edit the translations and save the result to a TMX file ready to be loaded in your application. The Nevron Dictionary Editor can be downloaded from Nevron's website.

NOV Localization Dictionaries are available by request. We already have partial translations of NOV to several languages. If you need to localize NOV strings too, send us an email to with information about the language you want to localize your application to and we will send you the dictionary for that language or the English dictionary if we do not have a translation into the language you want, yet.
See Also
Send Feedback