Пример #1
0
        /// <summary>
        /// 查阅指定类别的本地化名称。
        /// </summary>
        /// <returns>
        /// 类别的本地化名称;如果本地化名称不存在,则为 null。
        /// </returns>
        /// <param name="value">要查阅的类别的标识符。</param>
        protected override string GetLocalizedString(string value)
        {
            var str = LocalizeContext.GetResourceFromResourceManager(_resourceType, value);

            if (!string.IsNullOrEmpty(str))
            {
                return(str);
            }

            return(base.GetLocalizedString(value));
        }
Пример #2
0
 /// <summary>
 /// 建立  <see cref="SRDefaultValueAttribute"/> 的新实例
 /// </summary>
 public SRDefaultValueAttribute(Type resourceManagerType, string resourceKey)
     : base(null)
 {
     this._value = LocalizeContext.GetResourceFromResourceManager(resourceManagerType, resourceKey) ?? resourceKey;
 }
Пример #3
0
 /// <summary>
 /// 建立  <see cref="SRDefaultValueAttribute"/> 的新实例
 /// </summary>
 /// <param name="type"></param>
 /// <param name="value"></param>
 public SRDefaultValueAttribute(Type type, Type resourceManagerType, string resourceKey)
     : base(null)
 {
     this._value = System.ComponentModel.TypeDescriptor.GetConverter(type).ConvertFrom(LocalizeContext.GetResourceFromResourceManager(resourceManagerType, resourceKey) ?? resourceKey);
 }