mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Second iteration of source generated localized strings
- Strs renamed to strs - Generic params will now default to object instead of string for convenient argument passing - Many strings changed to use generated properties
This commit is contained in:
@@ -21,9 +21,9 @@ namespace NadekoBot.Modules.Utility
|
||||
expr.EvaluateParameter += Expr_EvaluateParameter;
|
||||
var result = expr.Evaluate();
|
||||
if (!expr.HasErrors())
|
||||
await SendConfirmAsync("⚙ " + GetText("result"), result.ToString()).ConfigureAwait(false);
|
||||
await SendConfirmAsync("⚙ " + GetText(strs.result), result.ToString()).ConfigureAwait(false);
|
||||
else
|
||||
await SendErrorAsync("⚙ " + GetText("error"), expr.Error).ConfigureAwait(false);
|
||||
await SendErrorAsync("⚙ " + GetText(strs.error), expr.Error).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static void Expr_EvaluateParameter(string name, NCalc.ParameterArgs args)
|
||||
|
@@ -138,7 +138,7 @@ namespace NadekoBot.Modules.Utility
|
||||
await ctx.SendPaginatedConfirmAsync(page, (curPage) =>
|
||||
{
|
||||
return _eb.Create().WithOkColor()
|
||||
.WithTitle(GetText("alias_list"))
|
||||
.WithTitle(GetText(strs.alias_list))
|
||||
.WithDescription(string.Join("\n",
|
||||
arr.Skip(curPage * 10).Take(10).Select(x => $"`{x.Key}` => `{x.Value}`")));
|
||||
|
||||
|
@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var embed = _eb.Create()
|
||||
.WithErrorColor()
|
||||
.WithDescription(GetText("config_not_found", Format.Code(name)))
|
||||
.AddField(GetText("config_list"), string.Join("\n", configNames));
|
||||
.AddField(GetText(strs.config_list), string.Join("\n", configNames));
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
return;
|
||||
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
var embed = _eb.Create()
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText("config_list"))
|
||||
.WithTitle(GetText(strs.config_list))
|
||||
.WithDescription(string.Join("\n", configNames));
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
@@ -91,7 +91,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var embed = _eb.Create()
|
||||
.WithErrorColor()
|
||||
.WithDescription(GetText("config_not_found", Format.Code(name)))
|
||||
.AddField(GetText("config_list"), string.Join("\n", configNames));
|
||||
.AddField(GetText(strs.config_list), string.Join("\n", configNames));
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
return;
|
||||
|
@@ -47,23 +47,23 @@ namespace NadekoBot.Modules.Utility
|
||||
if (string.IsNullOrWhiteSpace(features))
|
||||
features = "-";
|
||||
var embed = _eb.Create()
|
||||
.WithAuthor(GetText("server_info"))
|
||||
.WithAuthor(GetText(strs.server_info))
|
||||
.WithTitle(guild.Name)
|
||||
.AddField(GetText("id"), guild.Id.ToString(), true)
|
||||
.AddField(GetText("owner"), ownername.ToString(), true)
|
||||
.AddField(GetText("members"), guild.MemberCount.ToString(), true)
|
||||
.AddField(GetText("text_channels"), textchn.ToString(), true)
|
||||
.AddField(GetText("voice_channels"), voicechn.ToString(), true)
|
||||
.AddField(GetText("created_at"), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||
.AddField(GetText("region"), guild.VoiceRegionId.ToString(), true)
|
||||
.AddField(GetText("roles"), (guild.Roles.Count - 1).ToString(), true)
|
||||
.AddField(GetText("features"), features, true)
|
||||
.AddField(GetText(strs.id), guild.Id.ToString(), true)
|
||||
.AddField(GetText(strs.owner), ownername.ToString(), true)
|
||||
.AddField(GetText(strs.members), guild.MemberCount.ToString(), true)
|
||||
.AddField(GetText(strs.text_channels), textchn.ToString(), true)
|
||||
.AddField(GetText(strs.voice_channels), voicechn.ToString(), true)
|
||||
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||
.AddField(GetText(strs.region), guild.VoiceRegionId.ToString(), true)
|
||||
.AddField(GetText(strs.roles), (guild.Roles.Count - 1).ToString(), true)
|
||||
.AddField(GetText(strs.features), features, true)
|
||||
.WithOkColor();
|
||||
if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute))
|
||||
embed.WithThumbnailUrl(guild.IconUrl);
|
||||
if (guild.Emotes.Any())
|
||||
{
|
||||
embed.AddField(GetText("custom_emojis") + $"({guild.Emotes.Count})",
|
||||
embed.AddField(GetText(strs.custom_emojis) + $"({guild.Emotes.Count})",
|
||||
string.Join(" ", guild.Emotes
|
||||
.Shuffle()
|
||||
.Take(20)
|
||||
@@ -85,9 +85,9 @@ namespace NadekoBot.Modules.Utility
|
||||
var embed = _eb.Create()
|
||||
.WithTitle(ch.Name)
|
||||
.WithDescription(ch.Topic?.SanitizeMentions(true))
|
||||
.AddField(GetText("id"), ch.Id.ToString(), true)
|
||||
.AddField(GetText("created_at"), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||
.AddField(GetText("users"), usercount.ToString(), true)
|
||||
.AddField(GetText(strs.id), ch.Id.ToString(), true)
|
||||
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||
.AddField(GetText(strs.users), usercount.ToString(), true)
|
||||
.WithOkColor();
|
||||
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
}
|
||||
@@ -102,15 +102,15 @@ namespace NadekoBot.Modules.Utility
|
||||
return;
|
||||
|
||||
var embed = _eb.Create()
|
||||
.AddField(GetText("name"), $"**{user.Username}**#{user.Discriminator}", true);
|
||||
.AddField(GetText(strs.name), $"**{user.Username}**#{user.Discriminator}", true);
|
||||
if (!string.IsNullOrWhiteSpace(user.Nickname))
|
||||
{
|
||||
embed.AddField(GetText("nickname"), user.Nickname, true);
|
||||
embed.AddField(GetText(strs.nickname), user.Nickname, true);
|
||||
}
|
||||
embed.AddField(GetText("id"), user.Id.ToString(), true)
|
||||
.AddField(GetText("joined_server"), $"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}", true)
|
||||
.AddField(GetText("joined_discord"), $"{user.CreatedAt:dd.MM.yyyy HH:mm}", true)
|
||||
.AddField(GetText("roles"), $"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Take(10).Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions(true)}", true)
|
||||
embed.AddField(GetText(strs.id), user.Id.ToString(), true)
|
||||
.AddField(GetText(strs.joined_server), $"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}", true)
|
||||
.AddField(GetText(strs.joined_discord), $"{user.CreatedAt:dd.MM.yyyy HH:mm}", true)
|
||||
.AddField(GetText(strs.roles), $"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Take(10).Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions(true)}", true)
|
||||
.WithOkColor();
|
||||
|
||||
var av = user.RealAvatarUrl();
|
||||
|
@@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
return _eb.Create()
|
||||
.WithErrorColor()
|
||||
.WithDescription(GetText("no_invites"));
|
||||
.WithDescription(GetText(strs.no_invites));
|
||||
}
|
||||
|
||||
var embed = _eb.Create().WithOkColor();
|
||||
@@ -69,8 +69,8 @@ namespace NadekoBot.Modules.Utility
|
||||
var creator = inv.Inviter.ToString().TrimTo(25);
|
||||
var usesString = $"{inv.Uses} / {(inv.MaxUses == 0 ? "∞" : inv.MaxUses?.ToString())}";
|
||||
|
||||
var desc = $@"`{GetText("inv_uses")}` **{usesString}**
|
||||
`{GetText("inv_expire")}` **{expiryString}**
|
||||
var desc = $@"`{GetText(strs.inv_uses)}` **{usesString}**
|
||||
`{GetText(strs.inv_expire)}` **{expiryString}**
|
||||
|
||||
{inv.Url} ";
|
||||
embed.AddField($"#{i++} {creator}", desc);
|
||||
|
@@ -37,11 +37,11 @@ namespace NadekoBot.Modules.Utility
|
||||
var rem = (_service.Interval - (DateTime.UtcNow - _service.LastUpdate));
|
||||
var helpcmd = Format.Code(Prefix + "donate");
|
||||
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
|
||||
.WithDescription(GetText("clpa_obsolete"))
|
||||
.AddField(GetText("clpa_fail_already_title"), GetText("clpa_fail_already"))
|
||||
.AddField(GetText("clpa_fail_wait_title"), GetText("clpa_fail_wait"))
|
||||
.AddField(GetText("clpa_fail_conn_title"), GetText("clpa_fail_conn"))
|
||||
.AddField(GetText("clpa_fail_sup_title"), GetText("clpa_fail_sup", helpcmd))
|
||||
.WithDescription(GetText(strs.clpa_obsolete))
|
||||
.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("clpa_fail_sup", helpcmd))
|
||||
.WithFooter(GetText("clpa_next_update", rem)));
|
||||
}
|
||||
}
|
||||
|
@@ -114,9 +114,9 @@ namespace NadekoBot.Modules.Utility
|
||||
await ctx.Channel.EmbedAsync(_eb.Create(ctx)
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText("quote_id", $"#{data.Id}"))
|
||||
.AddField(GetText("trigger"), data.Keyword)
|
||||
.AddField(GetText("response"), data.Text.Length > 1000
|
||||
? GetText("redacted_too_long")
|
||||
.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("created_by", $"{data.AuthorName} ({data.AuthorId})"))
|
||||
).ConfigureAwait(false);
|
||||
@@ -164,7 +164,7 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
if (quote is null || quote.GuildId != ctx.Guild.Id)
|
||||
{
|
||||
await SendErrorAsync(GetText("quotes_notfound")).ConfigureAwait(false);
|
||||
await SendErrorAsync(GetText(strs.quotes_notfound)).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
if ((q?.GuildId != ctx.Guild.Id) || (!isAdmin && q.AuthorId != ctx.Message.Author.Id))
|
||||
{
|
||||
response = GetText("quotes_remove_none");
|
||||
response = GetText(strs.quotes_remove_none);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
var embed = _eb.Create()
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText("reminder_list"));
|
||||
.WithTitle(GetText(strs.reminder_list));
|
||||
|
||||
List<Reminder> rems;
|
||||
using (var uow = _db.GetDbContext())
|
||||
@@ -113,7 +113,7 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
else
|
||||
{
|
||||
embed.WithDescription(GetText("reminders_none"));
|
||||
embed.WithDescription(GetText(strs.reminders_none));
|
||||
}
|
||||
|
||||
embed.AddPaginatedFooter(page + 1, null);
|
||||
|
@@ -146,7 +146,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var description = GetRepeaterInfoString(runner);
|
||||
await ctx.Channel.EmbedAsync(_eb.Create()
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText("repeater_created"))
|
||||
.WithTitle(GetText(strs.repeater_created))
|
||||
.WithDescription(description));
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace NadekoBot.Modules.Utility
|
||||
}
|
||||
|
||||
var embed = _eb.Create()
|
||||
.WithTitle(GetText("list_of_repeaters"))
|
||||
.WithTitle(GetText(strs.list_of_repeaters))
|
||||
.WithOkColor();
|
||||
|
||||
var i = 0;
|
||||
@@ -190,13 +190,13 @@ namespace NadekoBot.Modules.Utility
|
||||
string description = "";
|
||||
if (_service.IsNoRedundant(runner.Repeater.Id))
|
||||
{
|
||||
description = Format.Underline(Format.Bold(GetText("no_redundant"))) + "\n\n";
|
||||
description = Format.Underline(Format.Bold(GetText(strs.no_redundant))) + "\n\n";
|
||||
}
|
||||
|
||||
description += $"<#{runner.Repeater.ChannelId}>\n" +
|
||||
$"`{GetText("Comment")}` {intervalString}\n" +
|
||||
$"`{GetText("executes_in_colon")}` {executesInString}\n" +
|
||||
$"`{GetText("message_colon")}` {message}";
|
||||
$"`{GetText(strs.interval_colon)}` {intervalString}\n" +
|
||||
$"`{GetText(strs.executes_in_colon)}` {executesInString}\n" +
|
||||
$"`{GetText(strs.message_colon)}` {message}";
|
||||
|
||||
return description;
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ namespace NadekoBot.Modules.Utility
|
||||
var units = _service.Units;
|
||||
|
||||
var embed = _eb.Create()
|
||||
.WithTitle(GetText("convertlist"))
|
||||
.WithTitle(GetText(strs.convertlist))
|
||||
.WithOkColor();
|
||||
|
||||
|
||||
|
@@ -114,7 +114,7 @@ namespace NadekoBot.Modules.Utility
|
||||
.ToList();
|
||||
|
||||
if (pageUsers.Count == 0)
|
||||
return _eb.Create().WithOkColor().WithDescription(GetText("no_user_on_this_page"));
|
||||
return _eb.Create().WithOkColor().WithDescription(GetText(strs.no_user_on_this_page));
|
||||
|
||||
return _eb.Create().WithOkColor()
|
||||
.WithTitle(GetText("inrole_list", Format.Bold(role?.Name ?? "No Role")) + $" - {roleUsers.Length}")
|
||||
@@ -234,7 +234,7 @@ namespace NadekoBot.Modules.Utility
|
||||
if (string.IsNullOrWhiteSpace(topic))
|
||||
await ReplyErrorLocalizedAsync("no_topic_set").ConfigureAwait(false);
|
||||
else
|
||||
await SendConfirmAsync(GetText("channel_topic"), topic).ConfigureAwait(false);
|
||||
await SendConfirmAsync(GetText(strs.channel_topic), topic).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
@@ -249,16 +249,16 @@ namespace NadekoBot.Modules.Utility
|
||||
.WithAuthor($"NadekoBot v{StatsService.BotVersion}",
|
||||
"https://nadeko-pictures.nyc3.digitaloceanspaces.com/other/avatar.png",
|
||||
"https://nadekobot.readthedocs.io/en/latest/")
|
||||
.AddField(GetText(Strs.author), _stats.Author, true)
|
||||
.AddField(GetText("botid"), _client.CurrentUser.Id.ToString(), true)
|
||||
.AddField(GetText("shard"), $"#{_client.ShardId} / {_creds.TotalShards}", true)
|
||||
.AddField(GetText("commands_ran"), _stats.CommandsRan.ToString(), true)
|
||||
.AddField(GetText("messages"), $"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)",
|
||||
.AddField(GetText(strs.author), _stats.Author, true)
|
||||
.AddField(GetText(strs.botid), _client.CurrentUser.Id.ToString(), true)
|
||||
.AddField(GetText(strs.shard), $"#{_client.ShardId} / {_creds.TotalShards}", true)
|
||||
.AddField(GetText(strs.commands_ran), _stats.CommandsRan.ToString(), true)
|
||||
.AddField(GetText(strs.messages), $"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)",
|
||||
true)
|
||||
.AddField(GetText("memory"), $"{_stats.Heap} MB", true)
|
||||
.AddField(GetText("owner_ids"), ownerIds, true)
|
||||
.AddField(GetText("uptime"), _stats.GetUptimeString("\n"), true)
|
||||
.AddField(GetText("presence"),
|
||||
.AddField(GetText(strs.memory), $"{_stats.Heap} MB", true)
|
||||
.AddField(GetText(strs.owner_ids), ownerIds, true)
|
||||
.AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true)
|
||||
.AddField(GetText(strs.presence),
|
||||
GetText("presence_txt",
|
||||
_coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels), true))
|
||||
.ConfigureAwait(false);
|
||||
|
Reference in New Issue
Block a user