using DevExpress.XtraGrid.Localization;
using System.Collections.Generic;

namespace DeviceRepairAndOptimization.Biz
{
    public class MyGridLocalizer : GridLocalizer
    {
        Dictionary<GridStringId, string> CusLocalizedKeyValue = null;

        public MyGridLocalizer(Dictionary<GridStringId, string> cusLocalizedKeyValues)
        {
            this.CusLocalizedKeyValue = cusLocalizedKeyValues;
        }

        public override string GetLocalizedString(GridStringId id)
        {
            if(CusLocalizedKeyValue != null)
            {
                string gridStringDisplay = string.Empty;
                foreach (var gridLocalizer in CusLocalizedKeyValue)
                {
                    if (gridLocalizer.Key.Equals(id))
                    {
                        gridStringDisplay = gridLocalizer.Value;
                        break;
                    }
                }

                return gridStringDisplay;
            }
            return base.GetLocalizedString(id);
        }
    }
}
