コード例 #1
0
ファイル: TranslationUtl.cs プロジェクト: dmay/gitextensions
 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);
 }
コード例 #2
0
ファイル: TranslationUtl.cs プロジェクト: Nehle/gitextensions
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public virtual void AddTranslationItems(Translation translation)
 {
     if (!string.IsNullOrEmpty(Text))
         translation.AddTranslationItem(Name, "$this", "Text", Text);
     TranslationUtl.AddTranslationItemsFromFields(Name, this, translation);
 }