Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 private string getLocalizedCMDDesc(IChatCommand cmd, Locale loc)
 {
     if (loc.ContainsKey(cmd.DescriptionID))
     {
         return(loc[cmd.DescriptionID]);
     }
     else
     {
         return(cmd.Description);
     }
 }
Exemplo n.º 3
0
 private string getLocalizedCMDArgDesc(ChatCommandArgument arg, Locale loc)
 {
     if (loc.ContainsKey(arg.DescriptionID))
     {
         return(loc[arg.DescriptionID]);
     }
     else
     {
         return(arg.Description);
     }
 }
Exemplo n.º 4
0
        public Grid AddLocale(string key, string value)
        {
            if (Locale.ContainsKey(key))
            {
                Locale[key] = value;
            }
            else
            {
                Locale.Add(key, value);
            }

            return(this);
        }
Exemplo n.º 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);
        }