Ribbon for WinForms | ComponentOne
In This Topic
    Apply Localization
    In This Topic

    The Ribbon control is embedded with a powerful localization feature which allows you to interact with it in different languages. The following image shows the Ribbon control when its localization is set to French.

    localization in ribbon

    Localize Dialog Box

    localize dialog

    The left pane of the Localize dialog box displays a tree listing the localizable string IDs, and on the right are the strings themselves. The string list contains the following columns:

    Column Description
    Name The string's name (ID)
    Default value The default (English) value of the string.
    Value The string value for the currently selected culture (the column header displays that culture).

    Below the list is the currently selected string's value, along with an optional description.

    The status bar displays the project which will contain the localized resources and the name of the ComponentOne assembly which is currently being localized.

    The Localize dialog box contains the following toolbar menu buttons:

    Button Description
    create new translation Create new translation begins a new localization for a ComponentOne assembly.
    open button Open opens an existing translation for a particular assembly.
    save button Save saves the current translation.
    saveas button Save as saves the current translation and allows you to select the project in which to save the translation.
    addculture button Add culture adds a new culture.
    delete culture button Delete culture removes a culture from the translations.
    select culture button Select culture selects the culture to display and edit.
    options button Options customizes the appearance and behavior of the localization window.

    Create New Translation

    Clicking the Create new translation button begins a new localization for a ComponentOne assembly. A dialog box opens for you to select the ComponentOne assembly to localize.

    click the button

    Note: The assembly must be referenced in the currently open solution.

    Open

    Clicking the Open button opens an existing translation for a particular assembly. All translations that you create are stored as .resx files and are automatically added to the project that you select while saving the translation. Clicking this item shows a dialog box where a previously saved translation can be selected.

    click open button

    After you have created and saved a translation, the Available cultures panel shows the list of cultures for which translations were created for the selected assembly.

    Save

    Clicking the Save button saves the current translation.

    The translation is saved in the project shown in the status bar. When the translation is saved, a folder with the name C1LocalizedResources is created in the selected project (if it does not already exist), and the .resx files with translations are saved in that folder and added to the project. For each culture, a separate .resx file is created. These files are visible in the Solution Explorer window.

    Note: If your translation is only for the invariant culture, the .resx file does not contain a culture suffix.

    Save As

    Clicking the Save as button saves the current translation and allows you to select the project in which to save the translation.

    Add Culture

    Clicking the Add culture button adds a new culture.

    You can make translations for several cultures. For each culture, a separate .resx file is created in the C1LocalizedResources folder. Clicking the Add culture button opens the Select culture dialog box that provides a list of available cultures:

    click addculture

    Initially the list contains neutral cultures only. To show all cultures, uncheck the Show only neutral cultures checkbox. You can use the English name, Display name, and Code boxes to filter the list of shown cultures. After you have selected a culture, press the OK button to add it to the translations. The newly added culture will appear in the Culture drop-down in the toolbar and will become current in the window.

    Delete Culture

    Clicking the Delete culture button removes a culture from the translations. The Select cultures to delete dialog box provides the list of cultures existing in the translations:

    click delete culture

    Selecting a culture and clicking OK removes it from the translations.

    Select Culture

    The Culture drop-down allows you to select the culture to display and edit.

    Options

    Clicking the Options button allows you to customize the appearance and behavior of the localization window.

    click options button

    The available localization options include:

    Option Description
    Sync tree with grid When this item is checked, selecting a string in the right panel list also selects that string in the tree on the left. By default this item is unchecked.
    Show names in grid When this item is checked, the Name column is shown in the right-hand panel, otherwise that column is hidden. By default this item is checked.
    Show selected group only When this item is checked, the list of strings on the right contains only the strings from the group currently selected in the tree on the left. By default this item is unchecked.

    Setting the Current Culture

    The Ribbon control uses the localization files automatically according to the culture selected in the application as long as the files have not been moved to another location or excluded from the project. The CurrentCulture property looks for the default strings of the current culture whereas the CurrentUICulture looks for the culture-specific resources at run-time. By default, the current culture is designated as System.Threading.Thread.CurrentThread.CurrentCulture. If you want to use a culture other than the current culture, you can set the desired culture in your application using the following code:

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("fr-FR")
        System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("fr-FR")
        InitializeComponent()
    End Sub
    
    public Form1()
    { 
        //Set the current culture to french
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");
    
        InitializeComponent();
    }