User Interface for .NET / User's Guide / Localization

In This Topic
    Localization
    In This Topic
     Overview

    The NLocalizationManager provides simple solution for localizing Nevron's internal strings. This make it easy to localize the whole Nevron Vision suit to a language of your choice. All you have to do is to translate the XML file that contains the localizable strings in your own language and then load it in the localization manager. The translation can be done using the built-in localization manager editor.

    The localization manager contains several dictionaries. Each of them holds the data for a specific component of the Nevron .NET Vision Suite. When the localization manager receives a translation request it first searches in the dictionary specified in the request and if no translation is found then it searches in the global dictionary. If the global dictionary does not contain a translation of the specified term either, then the term itself is returned as a result.

    The following code demonstrates how to load the localization data:

    C#
    Copy Code
    NLocalizationManager.Instance.Load(fileName);
    
    Visual Basic
    Copy Code
    NLocalizationManager.Instance.Load(fileName)
    

    To get the localized value for e specified term, you can use:

    C#
    Copy Code
    NLocalizationManager.Instance.Translate(term, localizationContextName);
    
    Visual Basic
    Copy Code
    NLocalizationManager.Instance.Translate(term, localizationContextName)
    

    If you omit the localization context name (i.e. the name of the dictionary to look in first) the localization manager will search for the term only in the global dictionary.

     Using the Built-in Editor

    Nevron localization support comes with a built-in editor for editing the current localization strings or creating custom dictionaries.

    The following code demonstrates how to display the editor:

    C#
    Copy Code
    NLocalizationManagerEditor editor = new NLocalizationManagerEditor();
    editor.ShowDialog();
    
    Visual Basic
    Copy Code
    Dim editor As NLocalizationManagerEditor = New NLocalizationManagerEditor()
    editor.ShowDialog()
    




    The Nevron Localization Manager Editor is used to edit the localization info used by the Nevron .NET Vision suite. Press the Load button to open the XML that contains all localizable strings. The Global context is populated with all strings and you can start translating them to your own language. If you need a specific translation for a context that differs from the global translation, then select the desired context from the drop down list and fill the translation of the entries for this context.

    The Combine button is used to append localization data from another xml file. The Synchronize button synchronizes the current localization manager with a one saved to a file, removing all dictionaries and entries that are not found in the file.

    The Add and Remove buttons placed next to the context drop down list are used to add a new context, or delete the current one. Note that the global context cannot be deleted. Next to them are situated the label that shows the total number of entries in the current context and the buttons that add and remove entries to it.

    Note that the string is queried “as is” and mnemonic (ampersand; &) characters are included also. For example the “&Close” string query will be displayed by a menu as “Close”.

     Enable/Disable the Localization Manager

    To enable or disable the localization manager simply use its Enabled property.

    See Also