예제 #1
0
 private string getLocalizedName(global::JetKarmaBot.Models.AwardType awardType, Locale loc)
 {
     if (loc.ContainsKey($"jetkarmabot.awardtypes.accusative.{awardType.CommandName}"))
     {
         return(loc[$"jetkarmabot.awardtypes.accusative.{awardType.CommandName}"]);
     }
     else
     {
         return(awardType.Name);
     }
 }
예제 #2
0
 private string getLocalizedCMDDesc(IChatCommand cmd, Locale loc)
 {
     if (loc.ContainsKey(cmd.DescriptionID))
     {
         return(loc[cmd.DescriptionID]);
     }
     else
     {
         return(cmd.Description);
     }
 }
예제 #3
0
 private string getLocalizedCMDArgDesc(ChatCommandArgument arg, Locale loc)
 {
     if (loc.ContainsKey(arg.DescriptionID))
     {
         return(loc[arg.DescriptionID]);
     }
     else
     {
         return(arg.Description);
     }
 }
예제 #4
0
        public Grid AddLocale(string key, string value)
        {
            if (Locale.ContainsKey(key))
            {
                Locale[key] = value;
            }
            else
            {
                Locale.Add(key, value);
            }

            return(this);
        }
예제 #5
0
        public override bool Validate(FieldInfo fieldInfo, object fieldValue, Type configType, object configValue, string name, ConfigFieldInfo[] confFieldInfos)
        {
            var key = fieldValue as string;

            if (string.IsNullOrEmpty(key))
            {
                using (var block = new ConsoleOutputErrorBlock())
                {
                    Console.WriteLine("{0}.xml elementId {1} 发现不存在的locale", name, TypeUtil.FindConfigKeyValue(configType, configValue));
                }
            }
            if (!Locale.ContainsKey(key))
            {
                using (var block = new ConsoleOutputErrorBlock())
                {
                    Console.WriteLine("{0}.xml elementId {1} 发现不存在的locale {2}", name, TypeUtil.FindConfigKeyValue(configType, configValue), fieldValue);
                }
            }
            return(true);
        }