public static void Translate(this Object data_control) { //Updat language if (SanitaLanguage.CurrentLanguage == SanitaLanguage.OldLanguage) { return; } //Do translate if (data_control is Control) { IList <Object> mListControl = GetAll(data_control).ToList(); mListControl = (from c in mListControl .Where(c => c is Office2007Form || c is Office2007RibbonForm || c is GroupPanel || c is Label || c is TextBox || c is LabelX || c is CheckBoxX || c is ButtonX || c is RibbonTabItem || c is TextBoxItem || c is CheckBoxItem || c is LabelItem || c is ButtonItem || c is SuperTabItem || c is OLVColumn ) select c).ToList(); foreach (Object control in mListControl) { if (control is TextBoxX) { (control as TextBoxX).WatermarkText = SanitaLanguage.GetLanguage((control as TextBoxX).WatermarkText); (control as TextBoxX).Text = SanitaLanguage.GetLanguage((control as TextBoxX).Text); } else if (control is TextBoxItem) { (control as TextBoxItem).WatermarkText = SanitaLanguage.GetLanguage((control as TextBoxItem).WatermarkText); (control as TextBoxItem).Text = SanitaLanguage.GetLanguage((control as TextBoxItem).Text); } else if (control is Control) { (control as Control).Text = SanitaLanguage.GetLanguage((control as Control).Text); } else if (control is BaseItem) { (control as BaseItem).Text = SanitaLanguage.GetLanguage((control as BaseItem).Text); } else if (control is OLVColumn) { (control as OLVColumn).Text = SanitaLanguage.GetLanguage((control as OLVColumn).Text); } } } }
public static String Translate(this String data_control) { if (SanitaLanguage.CurrentLanguage == SanitaLanguage.OldLanguage) { return(data_control); } return(SanitaLanguage.GetLanguage(data_control)); }