public static void AddTranslationItemsFromList(string category, Translation translation, IEnumerable<Tuple<string, object>> items) { Action<string, object, PropertyInfo> action = delegate(string item, object itemObj, PropertyInfo propertyInfo) { var value = (string)propertyInfo.GetValue(itemObj, null); if (AllowTranslateProperty(value)) translation.AddTranslationItem(category, item, propertyInfo.Name, value); }; ForEachItem(items, action); }
public static void AddTranslationItemsFromFields(string category, object obj, Translation translation) { if (obj == null) return; Action<string, object, PropertyInfo> action = delegate(string item, object itemObj, PropertyInfo propertyInfo) { var value = (string)propertyInfo.GetValue(itemObj, null); if (AllowTranslateProperty(value)) translation.AddTranslationItem(category, item, propertyInfo.Name, value); }; ForEachField(obj, action); }
public static void AddTranslationItemsFromList(string category, Translation translation, IEnumerable <Tuple <string, object> > items) { Action <string, object, PropertyInfo> action = delegate(string item, object itemObj, PropertyInfo propertyInfo) { var value = (string)propertyInfo.GetValue(itemObj, null); if (AllowTranslateProperty(value)) { translation.AddTranslationItem(category, item, propertyInfo.Name, value); } }; ForEachItem(items, action); }
public static void AddTranslationItemsFromFields(string category, object obj, Translation translation) { if (obj == null) { return; } Action <string, object, PropertyInfo> action = delegate(string item, object itemObj, PropertyInfo propertyInfo) { var value = (string)propertyInfo.GetValue(itemObj, null); if (!string.IsNullOrEmpty(value)) { translation.AddTranslationItem(category, item, propertyInfo.Name, value); } }; ForEachField(obj, action); }
public virtual void AddTranslationItems(Translation translation) { if (!string.IsNullOrEmpty(Text)) translation.AddTranslationItem(Name, "$this", "Text", Text); TranslationUtl.AddTranslationItemsFromFields(Name, this, translation); }