示例#1
0
        /// <summary>
        /// Initializes a static class that contains static LocalText objects. These objects actually
        /// contains localized texts in default language, but this method adds them to local text
        /// dictionary and replaces their values with text keys generated from concatting a prefix
        /// and the variable name.
        /// </summary>
        /// <param name="type">Type to initialize that contains texts</param>
        /// <param name="prefix">Prefix to add text keys (e.g. "Db.SomeCategory.")</param>
        public static void InitializeTextClass(Type type, string prefix)
        {
            dynamic t = type;

            foreach (var member in Object.Keys((type)).Clone())
            {

                
                object value = t[member];
                if (Type.IsInstanceOfType(value, typeof(LocalText)))
                {
                    var lt = value.As<LocalText>();
                    var key = prefix + member;
                    table[key] = lt.key;
                    t[member] = new LocalText(key);
                }
            }
        }
示例#2
0
 static LocalText()
 {
     Empty = new LocalText("");
 }
示例#3
0
文件: Texts.cs 项目: mhsabur/Serenity
 static Texts()
 {
     LocalText.InitializeTextClass(typeof(Dialogs), "Dialogs.");
 }
示例#4
0
 static Pager()
 {
     LocalText.InitializeTextClass(typeof(Pager), "Controls.Pager.");
 }
示例#5
0
 static EntityDialog()
 {
     LocalText.InitializeTextClass(typeof(EntityDialog), "Controls.EntityDialog.");
 }
 static EntityGrid()
 {
     LocalText.InitializeTextClass(typeof(EntityGrid), "Controls.EntityGrid.");
 }
 static PropertyGrid()
 {
     LocalText.InitializeTextClass(typeof(PropertyGrid), "Controls.PropertyGrid.");
 }
示例#8
0
 static LocalText()
 {
     Empty = new LocalText("");
 }
 static QuickSearch()
 {
     LocalText.InitializeTextClass(typeof(QuickSearch), "Controls.QuickSearch.");
 }