MvcValidatorToolkit/ValidationSet.cs
/// <summary>
/// Gets the localized text for the given key by looking up the App_GlobalResources folder.
/// </summary>
Gets the localized text for the given key by looking up the App_GlobalResources folder.
Gets the localized text for the given key by looking up the App_GlobalResources folder .
public virtual string GetLocalizedText(string key)
		{
			if(ResourceManagerDefault == null && ResourceManager == null)
			{
				Assembly assembly = null;
				try
				{
					assembly = Assembly.Load("App_GlobalResources");
				}
				catch { return null; }
				MessageResourceNameAttribute[] attributes = (MessageResourceNameAttribute[])GetType().GetCustomAttributes(typeof(MessageResourceNameAttribute), true);
				if(attributes.Length > 0)
					ResourceManager = new ResourceManager("Resources." + attributes[0].ResourceName, assembly);
				ResourceManagerDefault = new ResourceManager("Resources." +
					(string.IsNullOrEmpty(DefaultMessageResourceName) ? "ValidationSet" : DefaultMessageResourceName), assembly);
			}
			string text;
			if(ResourceManager != null)
			{
				try
				{
					if((text = ResourceManager.GetString(key)) != null)
						return text;
				}
				catch { }
			}
			if(ResourceManagerDefault != null)
			{
				try
				{
					if((text = ResourceManagerDefault.GetString(GetType().Name + "_" + key)) != null)
						return text;
				}
				catch { }
				try
				{
					if((text = ResourceManagerDefault.GetString(key)) != null)
						return text;
				}
				catch { }
			}
			return null;
		}
public virtual string GetLocalizedText ( string key ) { if ( ResourceManagerDefault == null && ResourceManager == null ) { Assembly assembly = null ; try { assembly = Assembly . Load ( " " ) ; } catch { return null ; } MessageResourceNameAttribute [ ] attributes = ( MessageResourceNameAttribute [ ] ) GetType ( ) . GetCustomAttributes ( typeof ( MessageResourceNameAttribute ) , true ) ; if ( attributes . Length > 0 ) ResourceManager = new ResourceManager ( " " + attributes [ 0 ] . ResourceName , assembly ) ; ResourceManagerDefault = new ResourceManager ( " " + ( string . IsNullOrEmpty ( DefaultMessageResourceName ) ? " " : DefaultMessageResourceName ) , assembly ) ; } string text ; if ( ResourceManager != null ) { try { if ( ( text = ResourceManager . GetString ( key ) ) != null ) return text ; } catch { } } if ( ResourceManagerDefault != null ) { try { if ( ( text = ResourceManagerDefault . GetString ( GetType ( ) . Name + " " + key ) ) != null ) return text ; } catch { } try { if ( ( text = ResourceManagerDefault . GetString ( key ) ) != null ) return text ; } catch { } } return null ; }
Gets the localized text for the given key by looking up the App_GlobalResources folder.
Gets the localized text for the given key by looking up the App_GlobalResources folder .
// Intializes the resource managers if not already done // If the MessageResource attribute for the implementing validation set is set, than // initialize the ResourceManager // Initialize the standard ResourceManager // Get the text for the key from custom resource file if defined // Get the text for the key from default resource file 
key
string