GridLocalizer Class

A base class that provides necessary functionality for custom localizers of the Data Grid control.

Namespace: DevExpress.XtraGrid.Localization

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

public class GridLocalizer :
    XtraLocalizer<GridStringId>
Public Class GridLocalizer
    Inherits XtraLocalizer(Of GridStringId)

Remarks

NOTE

Not all strings can be translated via Localizers. Specific components contain form resources (for example, the XtraReports Search dialog), which should use satellite assemblies for translation.

For more information on utilizing the GridLocalizer class, refer to the Localizing WinForms Controls via Localizer Objects document.

Examples

The following example demonstrates how to use localizers to translate strings into German:

This example creates localizers for the Data Grid UI and Editors UI. These localizers are GridLocalizer and Localizer class descendants.

cdLocalization_2


using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid.Localization;

public class GermanGridLocalizer : GridLocalizer {
    public override string Language { get { return "Deutsch"; } }
    public override string GetLocalizedString(GridStringId id) {
        string ret = "";
        switch (id) {
            // ... 
            case GridStringId.GridGroupPanelText: return "Ziehen Sie eine Spaltenüberschrift in diesen Bereich, um nach dieser zu gruppieren";
            case GridStringId.MenuColumnClearSorting: return "Sortierung entfernen";
            case GridStringId.MenuGroupPanelHide: return "Gruppierungsfeld ausblenden";
            case GridStringId.MenuColumnRemoveColumn: return "Spalte entfernen";
            case GridStringId.MenuColumnFilterEditor: return "Filter &bearbeiten";
            case GridStringId.MenuColumnFindFilterShow: return "Suche einblenden";
            case GridStringId.MenuColumnAutoFilterRowShow: return "Zeige Auto Filterzeile";
            case GridStringId.MenuColumnSortAscending: return "Aufsteigend sortieren";
            case GridStringId.MenuColumnSortDescending: return "Absteigend sortieren";
            case GridStringId.MenuColumnGroup: return "Gruppieren fur dieses Feld";
            case GridStringId.MenuColumnUnGroup: return "Gruppierung aufheben";
            case GridStringId.MenuColumnColumnCustomization: return "Laufzeit benutzerdefinierte Spalte";
            case GridStringId.MenuColumnBestFit: return "Optimale Breite";
            case GridStringId.MenuColumnFilter: return "Kann gruppieren";
            case GridStringId.MenuColumnClearFilter: return "Filter aufheben";
            case GridStringId.MenuColumnBestFitAllColumns: return "Optimale Breite (alle Spalten)";
            // ... 
            default:
                ret = base.GetLocalizedString(id);
                break;
        }
        return ret;
    }
}

public class GermanEditorsLocalizer : Localizer {
   public override string Language { get { return "Deutsch"; }}
   public override string GetLocalizedString(StringId id) {
      switch(id) {
         // ...
         case StringId.NavigatorTextStringFormat: return "Zeile {0} von {1}";
         case StringId.PictureEditMenuCut: return "Ausschneiden";
         case StringId.PictureEditMenuCopy: return "Kopieren";
         case StringId.PictureEditMenuPaste: return "Einfugen";
         case StringId.PictureEditMenuDelete: return "Loschen";
         case StringId.PictureEditMenuLoad: return "Laden";
         case StringId.PictureEditMenuSave: return "Speichern";
         // ...
      }
      return "";
   }
}

To use these localizers, assign instances of the GermanGridLocalizer and GermanEditorsLocalizer classes to the GridLocalizer.Active and Localizer.Active properties, respectively.

public Form1() {
    GridLocalizer.Active = new GermanGridLocalizer();
    Localizer.Active = new GermanEditorsLocalizer();
    InitializeComponent();
}

Inheritance

Object
DevExpress.Utils.Localization.XtraLocalizer
XtraLocalizer<DevExpress.XtraGrid.Localization.GridStringId>
GridLocalizer
See Also