/// <summary> /// Gets the data. /// </summary> /// <param name="args">The arguments.</param> /// <returns>System.String.</returns> public string GetData(AttributeHandlersArgs args) { var valAttr = (DynamicLocalizationAttribute)args.Attribute; var dependentProp = args.Invocation.InvocationTarget.GetType().GetProperty(valAttr.GetDependentProperty()); var dependentPropValue = dependentProp.GetValue(args.Invocation.InvocationTarget, null); var resKey = $"{valAttr.ResourcePrefix()}{dependentPropValue}"; var translation = DIResolver.Get <ILocalizationManager>().GetResource(resKey); return(translation); }
/// <summary> /// Determines whether the specified attribute has data. /// </summary> /// <param name="args">The arguments.</param> /// <returns><c>true</c> if the specified attribute has data; otherwise, <c>false</c>.</returns> public bool HasData(AttributeHandlersArgs args) { return(true); }
/// <summary> /// Gets the data. /// </summary> /// <param name="args">The arguments.</param> /// <returns>System.String.</returns> public string GetData(AttributeHandlersArgs args) { var locAttr = (StaticLocalizationAttribute)args.Attribute; return(DIResolver.Get <ILocalizationManager>().GetResource(locAttr.ResourceKey)); }
/// <summary> /// Determines whether this instance can process the specified attribute. /// </summary> /// <param name="args">The arguments.</param> /// <returns><c>true</c> if this instance can process the specified attribute; otherwise, <c>false</c>.</returns> public bool CanProcess(AttributeHandlersArgs args) { return(args.Attribute is StaticLocalizationAttribute); }
/// <summary> /// Gets the data. /// </summary> /// <param name="args">The arguments.</param> /// <returns>System.String.</returns> public string GetData(AttributeHandlersArgs args) { return(string.Empty); }
/// <summary> /// Determines whether this instance can process the specified attribute. /// </summary> /// <param name="args">The arguments.</param> /// <returns><c>true</c> if this instance can process the specified attribute; otherwise, <c>false</c>.</returns> public bool CanProcess(AttributeHandlersArgs args) { return(args.Attribute is AutoRefreshLocalizationAttribute); }
/// <summary> /// Determines whether the specified attribute has data. /// </summary> /// <param name="args">The arguments.</param> /// <returns><c>true</c> if the specified attribute has data; otherwise, <c>false</c>.</returns> public bool HasData(AttributeHandlersArgs args) { return(args.Value != null); }