mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
WIP: rework of localized strings, instead of generic LocStr, LocStr is now a struct which contains both the key, and the values which should be put into the value's placeholders. strs' properties are now methods which take values as arguments, and properties if they don't
This commit is contained in:
@@ -55,7 +55,7 @@ namespace NadekoBot.Modules.Utility
|
||||
"GetHashCode",
|
||||
"GetType"
|
||||
});
|
||||
await SendConfirmAsync(GetText(strs.calcops, Prefix), string.Join(", ", selection)).ConfigureAwait(false);
|
||||
await SendConfirmAsync(GetText(strs.calcops(Prefix), string.Join(", ", selection)).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var configNames = _settingServices.Select(x => x.Name);
|
||||
var embed = _eb.Create()
|
||||
.WithErrorColor()
|
||||
.WithDescription(GetText(strs.config_not_found, Format.Code(name)))
|
||||
.WithDescription(GetText(strs.config_not_found(Format.Code(name))))
|
||||
.AddField(GetText(strs.config_list), string.Join("\n", configNames));
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
@@ -90,7 +90,7 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
var embed = _eb.Create()
|
||||
.WithErrorColor()
|
||||
.WithDescription(GetText(strs.config_not_found, Format.Code(name)))
|
||||
.WithDescription(GetText(strs.config_not_found(Format.Code(name))))
|
||||
.AddField(GetText(strs.config_list), string.Join("\n", configNames));
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
@@ -123,7 +123,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var propStrings = GetPropsAndValuesString(setting, propNames);
|
||||
var propErrorEmbed = _eb.Create()
|
||||
.WithErrorColor()
|
||||
.WithDescription(GetText(strs.config_prop_not_found, Format.Code(prop), Format.Code(name)))
|
||||
.WithDescription(GetText(strs.config_prop_not_found(Format.Code(prop), Format.Code(name))))
|
||||
.AddField($"⚙️ {setting.Name}", propStrings);
|
||||
|
||||
await ctx.Channel.EmbedAsync(propErrorEmbed);
|
||||
|
@@ -142,9 +142,9 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(_eb.Create()
|
||||
.WithTitle(GetText(strs.activity_page, page + 1))
|
||||
.WithTitle(GetText(strs.activity_page(page + 1)))
|
||||
.WithOkColor()
|
||||
.WithFooter(GetText(strs.activity_users_total, CmdHandler.UserMessagesSent.Count))
|
||||
.WithFooter(GetText(strs.activity_users_total(CmdHandler.UserMessagesSent.Count)))
|
||||
.WithDescription(str.ToString())).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
@@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var inv = invites.ElementAt(index);
|
||||
await inv.DeleteAsync().ConfigureAwait(false);
|
||||
|
||||
await ReplyAsync(GetText(strs.invite_deleted, Format.Bold(inv.Code.ToString()))).ConfigureAwait(false);
|
||||
await ReplyAsync(GetText(strs.invite_deleted(Format.Bold(inv.Code.ToString()))).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,8 +41,8 @@ namespace NadekoBot.Modules.Utility
|
||||
.AddField(GetText(strs.clpa_fail_already_title), GetText(strs.clpa_fail_already))
|
||||
.AddField(GetText(strs.clpa_fail_wait_title), GetText(strs.clpa_fail_wait))
|
||||
.AddField(GetText(strs.clpa_fail_conn_title), GetText(strs.clpa_fail_conn))
|
||||
.AddField(GetText(strs.clpa_fail_sup_title), GetText(strs.clpa_fail_sup, helpcmd))
|
||||
.WithFooter(GetText(strs.clpa_next_update, rem)));
|
||||
.AddField(GetText(strs.clpa_fail_sup_title), GetText(strs.clpa_fail_sup(helpcmd)))
|
||||
.WithFooter(GetText(strs.clpa_next_update(rem))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
|
||||
if (quotes.Any())
|
||||
await SendConfirmAsync(GetText(strs.quotes_page, page + 1),
|
||||
await SendConfirmAsync(GetText(strs.quotes_page(page + 1)),
|
||||
string.Join("\n", quotes.Select(q => $"`#{q.Id}` {Format.Bold(q.Keyword.SanitizeAllMentions()),-20} by {q.AuthorName.SanitizeAllMentions()}")))
|
||||
.ConfigureAwait(false);
|
||||
else
|
||||
@@ -113,12 +113,12 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
await ctx.Channel.EmbedAsync(_eb.Create(ctx)
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText(strs.quote_id, $"#{data.Id}"))
|
||||
.WithTitle(GetText(strs.quote_id($"#{data.Id}")))
|
||||
.AddField(GetText(strs.trigger), data.Keyword)
|
||||
.AddField(GetText(strs.response), data.Text.Length > 1000
|
||||
? GetText(strs.redacted_too_long)
|
||||
: Format.Sanitize(data.Text))
|
||||
.WithFooter(GetText(strs.created_by, $"{data.AuthorName} ({data.AuthorId})"))
|
||||
.WithFooter(GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})")))
|
||||
).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace NadekoBot.Modules.Utility
|
||||
uow.Quotes.Remove(q);
|
||||
await uow.SaveChangesAsync();
|
||||
success = true;
|
||||
response = GetText(strs.quote_deleted, id);
|
||||
response = GetText(strs.quote_deleted(id));
|
||||
}
|
||||
}
|
||||
if (success)
|
||||
|
@@ -50,7 +50,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var description = GetRepeaterInfoString(removed);
|
||||
await ctx.Channel.EmbedAsync(_eb.Create()
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText(strs.repeater_removed, index + 1))
|
||||
.WithTitle(GetText(strs.repeater_removed(index + 1)))
|
||||
.WithDescription(description));
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
res = Math.Round(res, 4);
|
||||
|
||||
await SendConfirmAsync(GetText(strs.convert, value, originUnit.Triggers.Last(), res, targetUnit.Triggers.Last())).ConfigureAwait(false);
|
||||
await SendConfirmAsync(GetText(strs.convert(value, originUnit.Triggers.Last(), res, targetUnit.Triggers.Last())).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ namespace NadekoBot.Modules.Utility
|
||||
return _eb.Create().WithOkColor().WithDescription(GetText(strs.no_user_on_this_page));
|
||||
|
||||
return _eb.Create().WithOkColor()
|
||||
.WithTitle(GetText(strs.inrole_list, Format.Bold(role?.Name ?? "No Role")) + $" - {roleUsers.Length}")
|
||||
.WithTitle(GetText(strs.inrole_list(Format.Bold(role?.Name ?? "No Role")) + $" - {roleUsers.Length}"))
|
||||
.WithDescription(string.Join("\n", pageUsers));
|
||||
}, roleUsers.Length, 20).ConfigureAwait(false);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ namespace NadekoBot.Modules.Utility
|
||||
else
|
||||
{
|
||||
|
||||
await SendConfirmAsync(GetText(strs.roles_page, page, Format.Bold(target.ToString())),
|
||||
await SendConfirmAsync(GetText(strs.roles_page(page, Format.Bold(target.ToString()))),
|
||||
"\n• " + string.Join("\n• ", (IEnumerable<IRole>)roles).SanitizeMentions(true)).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
else
|
||||
{
|
||||
await SendConfirmAsync(GetText(strs.roles_all_page, page),
|
||||
await SendConfirmAsync(GetText(strs.roles_all_page(page)),
|
||||
"\n• " + string.Join("\n• ", (IEnumerable<IRole>)roles).SanitizeMentions(true)).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
var tags = ctx.Message.Tags.Where(t => t.Type == TagType.Emoji).Select(t => (Emote)t.Value);
|
||||
|
||||
var result = string.Join("\n", tags.Select(m => GetText(strs.showemojis, m, m.Url)));
|
||||
var result = string.Join("\n", tags.Select(m => GetText(strs.showemojis(m, m.Url))));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(result))
|
||||
await ReplyErrorLocalizedAsync("showemojis_none").ConfigureAwait(false);
|
||||
@@ -298,7 +298,7 @@ namespace NadekoBot.Modules.Utility
|
||||
.WithOkColor();
|
||||
foreach (var guild in guilds)
|
||||
embed.AddField(guild.Name,
|
||||
GetText(strs.listservers, guild.Id, guild.MemberCount, guild.OwnerId),
|
||||
GetText(strs.listservers(guild.Id, guild.MemberCount, guild.OwnerId)),
|
||||
false);
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
|
Reference in New Issue
Block a user