GetDefault() public static method

Tries to get localized text or if not found, default
public static GetDefault ( string key, string defaultText ) : string
key string Text key
defaultText string Default text
return string
Ejemplo n.º 1
0
        protected virtual string GetEntitySingular()
        {
            if (entitySingular == null)
            {
                var attributes = this.GetType().GetCustomAttributes(typeof(ItemNameAttribute), true);
                if (attributes.Length >= 1)
                {
                    entitySingular = attributes[0].As<ItemNameAttribute>().Value;
                    entitySingular = LocalText.GetDefault(entitySingular, entitySingular);
                }
                else
                    entitySingular = (Q.TryGetText(GetLocalTextPrefix() + "EntitySingular") ?? GetEntityType());
            }

            return entitySingular;
        }
Ejemplo n.º 2
0
        protected virtual string GetItemName()
        {
            if (itemName == null)
            {
                var attributes = this.GetType().GetCustomAttributes(typeof(ItemNameAttribute), true);
                if (attributes.Length >= 1)
                {
                    itemName = attributes[0].As <ItemNameAttribute>().Value;
                    itemName = LocalText.GetDefault(itemName, itemName);
                }
                else
                {
                    itemName = (Q.TryGetText(GetLocalTextDbPrefix() + "EntitySingular") ?? GetEntityType());
                }
            }

            return(itemName);
        }
Ejemplo n.º 3
0
        protected virtual string GetDisplayName()
        {
            if (displayName == null)
            {
                var attributes = this.GetType().GetCustomAttributes(typeof(DisplayNameAttribute), true);
                if (attributes.Length >= 1)
                {
                    displayName = attributes[0].As <DisplayNameAttribute>().DisplayName;
                    displayName = LocalText.GetDefault(displayName, displayName);
                }
                else
                {
                    displayName = (Q.TryGetText(GetLocalTextDbPrefix() + "EntityPlural") ?? GetEntityType());
                }
            }

            return(displayName);
        }