public EmbedFieldBuilder Localise(ITextResourceCollection textResource) => new EmbedFieldBuilder { Name = Name?.Localise(textResource), Value = Value?.Localise(textResource), IsInline = IsInline };
public EmbedAuthorBuilder Localise(ITextResourceCollection textResource) => new EmbedAuthorBuilder { Name = Name?.Localise(textResource), Url = Url?.Localise(textResource), IconUrl = IconUrl?.Localise(textResource) };
private string MakeTable(ITextResourceCollection textResource, IEnumerable <Helper> helpers) => "```\n" + helpers.Select(h => new[] { h.Abbreviations.Localise(textResource), new LocalisedString(HelperText.COST, h.BaseCost).Localise(textResource) }).ToArray() .Tableify() + "\n```";
public virtual string Localise(ITextResourceCollection textResource) { if (Key == null) { return(null); } var prepped = _values.Select(v => v is ILocalisable ls ? ls.Localise(textResource) : v).ToArray(); return(textResource.Format(Key, ReplyType, prepped)); }
public override string Localise(ITextResourceCollection tr) { if (Key == null) { return(null); } var prepped = Values.Select(v => v is ILocalisable ls ? ls.Localise(tr) : v) .Select(v => tr.Formatter.Beautify(tr.FormatType, v)) .ToArray(); return(tr.GetReplyType(ReplyType) + string.Format(Key, prepped)); }
public string Localise(ITextResourceCollection textResource) { string Format(string key) => $"`{key}{(RequiresInput ? $" <{ParamName}>" : "")}`"; var text = Format($"-{ShortKey}"); if (LongKey != null) { text += " / " + Format($"--{LongKey}"); } return(text + $" = {textResource.GetResource(Description)}"); }
public static string[] GetNames(this EquipmentClass equipClass, ITextResourceCollection textResource) { var alt = EquipmentClassText.LocalisableAlt(equipClass).Localise(textResource); var main = equipClass.ToLocalisable().Localise(textResource); if (alt == null) { return new string[] { main } } ; else { return new string[] { main } }.Concat(alt.Split(',')).ToArray();
public virtual double MatchCertainty(ITextResourceCollection textResource, string text) { text = text.ToLower(); var id = Id.ToString().ToLower(); var name = Name.Localise(textResource).ToLower(); var abbrev = Abbreviations?.Localise(textResource).ToLower().Split(','); return(new List <double> { id == text ? 0.95 : 0, name == text ? 0.9 : 0, abbrev?.Any(a => a == text) ?? false ? 0.9 : 0, id.StartsWith(text) ? 0.75 : 0, name.StartsWith(text) ? 0.7 : 0, id.Contains(text) ? 0.55 : 0, name.Contains(text) ? 0.5 : 0, id.Without(" ") == text.Without(" ") ? 0.35 : 0, name.Without(" ") == text.Without(" ") ? 0.3 : 0, id.Without(" ").StartsWith(text.Without(" ")) ? 0.15 : 0, name.Without(" ").StartsWith(text.Without(" ")) ? 0.1 : 0, }.Max()); }
object ILocalisable.Localise(ITextResourceCollection textResource) => Localise(textResource);
public EmbedFooterBuilder Localise(ITextResourceCollection textResource) => new EmbedFooterBuilder { Text = Text?.Localise(textResource), IconUrl = IconUrl?.Localise(textResource) };
public virtual string Localise(ITextResourceCollection textResource) => $"**{Name.Localise(textResource)}** ({Id})";
public override string Localise(ITextResourceCollection textResource) => LocalisationFunc?.Invoke(textResource);