This commit is contained in:
Kwoth 2017-02-13 14:23:29 +01:00
parent dadb7f0166
commit 1da9c0ae5a
2 changed files with 7 additions and 4 deletions

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace NadekoBot.Modules.Administration.Commands namespace NadekoBot.Modules.Administration
{ {
public partial class Administration public partial class Administration
{ {

View File

@ -12,8 +12,8 @@ namespace NadekoBot.Modules
public abstract class NadekoModule : ModuleBase public abstract class NadekoModule : ModuleBase
{ {
protected readonly Logger _log; protected readonly Logger _log;
protected CultureInfo _cultureInfo { get; private set; }
public readonly string _prefix; public readonly string _prefix;
public readonly CultureInfo cultureInfo;
public readonly string ModuleTypeName; public readonly string ModuleTypeName;
public readonly string LowerModuleTypeName; public readonly string LowerModuleTypeName;
@ -26,8 +26,11 @@ namespace NadekoBot.Modules
if (!NadekoBot.ModulePrefixes.TryGetValue(ModuleTypeName, out _prefix)) if (!NadekoBot.ModulePrefixes.TryGetValue(ModuleTypeName, out _prefix))
_prefix = "?err?"; _prefix = "?err?";
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
}
cultureInfo = (Context.Guild == null protected override void BeforeExecute()
{
_cultureInfo = (Context.Guild == null
? CultureInfo.CurrentCulture ? CultureInfo.CurrentCulture
: NadekoBot.Localization.GetCultureInfo(Context.Guild)); : NadekoBot.Localization.GetCultureInfo(Context.Guild));
} }
@ -54,7 +57,7 @@ namespace NadekoBot.Modules
protected string GetText(string key) protected string GetText(string key)
{ {
return NadekoBot.ResponsesResourceManager.GetString(LowerModuleTypeName + "_" + key, cultureInfo); return NadekoBot.ResponsesResourceManager.GetString(LowerModuleTypeName + "_" + key, _cultureInfo);
} }
protected string GetText(string key, params object[] replacements) protected string GetText(string key, params object[] replacements)