Changed last few usages of old string based gettext. All strings now use new system. Needs testing

This commit is contained in:
Kwoth
2021-07-31 23:39:19 +02:00
parent 919bedeae6
commit 565c1132fa
4 changed files with 14 additions and 14 deletions

View File

@@ -74,7 +74,7 @@ namespace NadekoBot.Modules.Help.Services
var reqs = GetCommandRequirements(com, overrides);
if(reqs.Any())
{
em.AddField(GetText("requires", guild), string.Join("\n", reqs));
em.AddField(GetText(strs.requires, guild), string.Join("\n", reqs));
}
em
@@ -82,7 +82,7 @@ namespace NadekoBot.Modules.Help.Services
string.Join("\n", Array.ConvertAll(com.RealRemarksArr(_strings, guild?.Id, prefix),
arg => Format.Code(arg))),
false)
.WithFooter(GetText("module", guild, com.Module.GetTopLevelModule().Name))
.WithFooter(GetText(strs.module(com.Module.GetTopLevelModule().Name), guild))
.WithOkColor();
var opt = ((NadekoOptionsAttribute)com.Attributes.FirstOrDefault(x => x is NadekoOptionsAttribute))?.OptionType;
@@ -90,7 +90,7 @@ namespace NadekoBot.Modules.Help.Services
{
var hs = GetCommandOptionHelp(opt);
if(!string.IsNullOrWhiteSpace(hs))
em.AddField(GetText("options", guild), hs, false);
em.AddField(GetText(strs.options, guild), hs, false);
}
return em;
@@ -172,7 +172,7 @@ namespace NadekoBot.Modules.Help.Services
.Replace("Guild", "Server", StringComparison.InvariantCulture);
}
private string GetText(string text, IGuild guild, params object[] replacements) =>
_strings.GetText(text, guild?.Id, replacements);
private string GetText(LocStr str, IGuild guild, params object[] replacements) =>
_strings.GetText(str, guild?.Id);
}
}

View File

@@ -305,9 +305,6 @@ namespace NadekoBot.Modules.Music.Services
return Array.Empty<(string, string)>();
}
private string GetText(ulong guildId, string key, params object[] args)
=> _strings.GetText(key, guildId, args);
private string GetText(ulong guildId, LocStr str)
=> _strings.GetText(str, guildId);

View File

@@ -447,8 +447,8 @@ namespace NadekoBot.Modules.Searches.Services
.WithTitle(status.Name)
.WithUrl(status.StreamUrl)
.WithDescription(status.StreamUrl)
.AddField(GetText(guildId, "status"), status.IsLive ? "🟢 Online" : "🔴 Offline", true)
.AddField(GetText(guildId, "viewers"), status.IsLive ? status.Viewers.ToString() : "-", true);
.AddField(GetText(guildId, strs.status), status.IsLive ? "🟢 Online" : "🔴 Offline", true)
.AddField(GetText(guildId, strs.viewers), status.IsLive ? status.Viewers.ToString() : "-", true);
if (status.IsLive)
embed = embed.WithOkColor();
@@ -459,7 +459,7 @@ namespace NadekoBot.Modules.Searches.Services
embed.WithAuthor(status.Title);
if (!string.IsNullOrWhiteSpace(status.Game))
embed.AddField(GetText(guildId, "streaming"), status.Game, true);
embed.AddField(GetText(guildId, strs.streaming), status.Game, true);
if (!string.IsNullOrWhiteSpace(status.AvatarUrl))
embed.WithThumbnailUrl(status.AvatarUrl);
@@ -470,8 +470,8 @@ namespace NadekoBot.Modules.Searches.Services
return embed;
}
private string GetText(ulong guildId, string key, params object[] replacements)
=> _strings.GetText(key, guildId, replacements);
private string GetText(ulong guildId, LocStr str)
=> _strings.GetText(str, guildId);
public bool ToggleStreamOffline(ulong guildId)
{

View File

@@ -258,7 +258,10 @@ namespace NadekoBot.Modules.Utility
.AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true)
.AddField(GetText(strs.presence),
GetText(strs.presence_txt(
_coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels)), true))
_coord.GetGuildCount(),
_stats.TextChannels,
_stats.VoiceChannels)),
true))
.ConfigureAwait(false);
}