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

@@ -139,11 +139,11 @@ namespace NadekoBot.Modules.Xp
.WithOkColor()
.WithTitle($"{club.ToString()}")
.WithDescription(GetText("level_x", lvl.Level) + $" ({club.Xp} xp)")
.AddField(GetText("desc"), string.IsNullOrWhiteSpace(club.Description) ? "-" : club.Description,
.AddField(GetText(strs.desc), string.IsNullOrWhiteSpace(club.Description) ? "-" : club.Description,
false)
.AddField(GetText("owner"), club.Owner.ToString(), true)
.AddField(GetText("level_req"), club.MinimumLevelReq.ToString(), true)
.AddField(GetText("members"), string.Join("\n", users
.AddField(GetText(strs.owner), club.Owner.ToString(), true)
.AddField(GetText(strs.level_req), club.MinimumLevelReq.ToString(), true)
.AddField(GetText(strs.members), string.Join("\n", users
.Skip(page * 10)
.Take(10)
.Select(x =>

View File

@@ -23,8 +23,8 @@ namespace NadekoBot.Modules.Xp
public async Task XpReset(ulong userId)
{
var embed = _eb.Create()
.WithTitle(GetText("reset"))
.WithDescription(GetText("reset_user_confirm"));
.WithTitle(GetText(strs.reset))
.WithDescription(GetText(strs.reset_user_confirm));
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
return;
@@ -40,8 +40,8 @@ namespace NadekoBot.Modules.Xp
public async Task XpReset()
{
var embed = _eb.Create()
.WithTitle(GetText("reset"))
.WithDescription(GetText("reset_server_confirm"));
.WithTitle(GetText(strs.reset))
.WithDescription(GetText(strs.reset_server_confirm));
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
return;

View File

@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Xp
{
var reply = await PromptUserConfirmAsync(_eb.Create()
.WithPendingColor()
.WithDescription(GetText("xprewsreset_confirm")));
.WithDescription(GetText(strs.xprewsreset_confirm)));
if (!reply)
return;
@@ -92,7 +92,7 @@ namespace NadekoBot.Modules.Xp
return Context.SendPaginatedConfirmAsync(page, cur =>
{
var embed = _eb.Create()
.WithTitle(GetText("level_up_rewards"))
.WithTitle(GetText(strs.level_up_rewards))
.WithOkColor();
var localRewards = allRewards
@@ -101,7 +101,7 @@ namespace NadekoBot.Modules.Xp
.ToList();
if (!localRewards.Any())
return embed.WithDescription(GetText("no_level_up_rewards"));
return embed.WithDescription(GetText(strs.no_level_up_rewards));
foreach (var reward in localRewards)
{
@@ -182,15 +182,15 @@ namespace NadekoBot.Modules.Xp
{
if (loc == XpNotificationLocation.Channel)
{
return GetText("xpn_notif_channel");
return GetText(strs.xpn_notif_channel);
}
if (loc == XpNotificationLocation.Dm)
{
return GetText("xpn_notif_dm");
return GetText(strs.xpn_notif_dm);
}
return GetText("xpn_notif_disabled");
return GetText(strs.xpn_notif_disabled);
}
[NadekoCommand, Aliases]
@@ -202,8 +202,8 @@ namespace NadekoBot.Modules.Xp
var embed = _eb.Create()
.WithOkColor()
.AddField(GetText("xpn_setting_global"), GetNotifLocationString(globalSetting))
.AddField(GetText("xpn_setting_server"), GetNotifLocationString(serverSetting));
.AddField(GetText(strs.xpn_setting_global), GetNotifLocationString(globalSetting))
.AddField(GetText(strs.xpn_setting_server), GetNotifLocationString(serverSetting));
await ctx.Channel.EmbedAsync(embed);
}
@@ -280,8 +280,8 @@ namespace NadekoBot.Modules.Xp
var rolesStr = roles.Any() ? string.Join("\n", roles) + "\n" : string.Empty;
var chansStr = chans.Count > 0 ? string.Join("\n", chans) + "\n" : string.Empty;
var desc = Format.Code(serverExcluded
? GetText("server_is_excluded")
: GetText("server_is_not_excluded"));
? GetText(strs.server_is_excluded)
: GetText(strs.server_is_not_excluded));
desc += "\n\n" + rolesStr + chansStr;
@@ -289,7 +289,7 @@ namespace NadekoBot.Modules.Xp
await ctx.SendPaginatedConfirmAsync(0, curpage =>
{
var embed = _eb.Create()
.WithTitle(GetText("exclusion_list"))
.WithTitle(GetText(strs.exclusion_list))
.WithDescription(string.Join('\n', lines.Skip(15 * curpage).Take(15)))
.WithOkColor();
@@ -332,7 +332,7 @@ namespace NadekoBot.Modules.Xp
await ctx.SendPaginatedConfirmAsync(page, (curPage) =>
{
var embed = _eb.Create()
.WithTitle(GetText("server_leaderboard"))
.WithTitle(GetText(strs.server_leaderboard))
.WithOkColor();
List<UserXpStats> users;
@@ -380,7 +380,7 @@ namespace NadekoBot.Modules.Xp
var users = _service.GetUserXps(page);
var embed = _eb.Create()
.WithTitle(GetText("global_leaderboard"))
.WithTitle(GetText(strs.global_leaderboard))
.WithOkColor();
if (!users.Any())