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:
Kwoth
2021-07-24 20:41:07 +02:00
parent 34d0f66466
commit 70288f7670
63 changed files with 410 additions and 363 deletions

View File

@@ -69,7 +69,7 @@ namespace NadekoBot.Modules.Permissions
return _eb.Create()
.WithOkColor()
.WithTitle(title)
.WithDescription(GetText("empty_page"));
.WithDescription(GetText(strs.empty_page));
}
return _eb.Create()
@@ -86,7 +86,7 @@ namespace NadekoBot.Modules.Permissions
if (--page < 0)
return Task.CompletedTask;
return ListBlacklistInternal(GetText("blacklisted_users"), BlacklistType.User, page);
return ListBlacklistInternal(GetText(strs.blacklisted_users), BlacklistType.User, page);
}
[NadekoCommand, Aliases]
@@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Permissions
if (--page < 0)
return Task.CompletedTask;
return ListBlacklistInternal(GetText("blacklisted_channels"), BlacklistType.Channel, page);
return ListBlacklistInternal(GetText(strs.blacklisted_channels), BlacklistType.Channel, page);
}
[NadekoCommand, Aliases]
@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Permissions
if (--page < 0)
return Task.CompletedTask;
return ListBlacklistInternal(GetText("blacklisted_servers"), BlacklistType.Server, page);
return ListBlacklistInternal(GetText(strs.blacklisted_servers), BlacklistType.Server, page);
}
[NadekoCommand, Aliases]

View File

@@ -93,7 +93,7 @@ namespace NadekoBot.Modules.Permissions
if (!localSet.Any())
await ReplyConfirmLocalizedAsync("cmdcd_none").ConfigureAwait(false);
else
await channel.SendTableAsync("", localSet.Select(c => c.CommandName + ": " + c.Seconds + GetText("sec")), s => $"{s,-30}", 2).ConfigureAwait(false);
await channel.SendTableAsync("", localSet.Select(c => c.CommandName + ": " + c.Seconds + GetText(strs.sec)), s => $"{s,-30}", 2).ConfigureAwait(false);
}
}
}

View File

@@ -288,7 +288,7 @@ namespace NadekoBot.Modules.Permissions
await ctx.SendPaginatedConfirmAsync(page,
(curPage) => _eb.Create()
.WithTitle(GetText("filter_word_list"))
.WithTitle(GetText(strs.filter_word_list))
.WithDescription(string.Join("\n", fws.Skip(curPage * 10).Take(10)))
.WithOkColor()
, fws.Length, 10).ConfigureAwait(false);

View File

@@ -39,12 +39,12 @@ namespace NadekoBot.Modules.Permissions
var embed = _eb.Create().WithOkColor();
if (blockedModule.Any())
embed.AddField(GetText("blocked_modules")
embed.AddField(GetText(strs.blocked_modules)
, string.Join("\n", _service.BlockedModules)
, false);
if (blockedCommands.Any())
embed.AddField(GetText("blocked_commands")
embed.AddField(GetText(strs.blocked_commands)
, string.Join("\n", _service.BlockedCommands)
, false);

View File

@@ -130,7 +130,7 @@ namespace NadekoBot.Modules.Permissions
var str =
$"`{p.Index + 1}.` {Format.Bold(p.GetCommand(Prefix, (SocketGuild)ctx.Guild))}";
if (p.Index == 0)
str += $" [{GetText("uneditable")}]";
str += $" [{GetText(strs.uneditable)}]";
return str;
}));
@@ -236,13 +236,13 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("sx_enable",
Format.Code(command.Name),
GetText("of_command")).ConfigureAwait(false);
GetText(strs.of_command)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("sx_disable",
Format.Code(command.Name),
GetText("of_command")).ConfigureAwait(false);
GetText(strs.of_command)).ConfigureAwait(false);
}
}
@@ -263,13 +263,13 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("sx_enable",
Format.Code(module.Name),
GetText("of_module")).ConfigureAwait(false);
GetText(strs.of_module)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("sx_disable",
Format.Code(module.Name),
GetText("of_module")).ConfigureAwait(false);
GetText(strs.of_module)).ConfigureAwait(false);
}
}
@@ -291,14 +291,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("ux_enable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(user.ToString())).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("ux_disable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(user.ToString())).ConfigureAwait(false);
}
}
@@ -320,14 +320,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("ux_enable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(user.ToString())).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("ux_disable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(user.ToString())).ConfigureAwait(false);
}
}
@@ -353,14 +353,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("rx_enable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(role.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("rx_disable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(role.Name)).ConfigureAwait(false);
}
}
@@ -386,14 +386,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("rx_enable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(role.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("rx_disable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(role.Name)).ConfigureAwait(false);
}
}
@@ -416,14 +416,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("cx_enable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("cx_disable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
}
@@ -445,14 +445,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("cx_enable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("cx_disable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
}