From 023df131217b609c0a3e70d7426eebb76ba3054f Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 13 Feb 2017 21:29:06 +0100 Subject: [PATCH] Clash of clans completely localizable, fixes, improvements :ok: :100: --- .../Modules/ClashOfClans/ClashOfClans.cs | 51 +++-- .../Modules/ClashOfClans/Extensions.cs | 33 ++- .../Games/Commands/PlantAndPickCommands.cs | 11 - src/NadekoBot/Modules/NadekoModule.cs | 33 +-- src/NadekoBot/Modules/Pokemon/Pokemon.cs | 2 +- .../Resources/ResponseStrings.Designer.cs | 207 ++++++++++++++++++ src/NadekoBot/Resources/ResponseStrings.resx | 69 ++++++ .../Resources/ResponseStrings.sr-cyrl-rs.resx | 69 ++++++ src/NadekoBot/Services/Impl/Localization.cs | 8 +- 9 files changed, 419 insertions(+), 64 deletions(-) diff --git a/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs b/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs index 83e6d00b..1ed31a6e 100644 --- a/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs +++ b/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs @@ -73,7 +73,11 @@ namespace NadekoBot.Modules.ClashOfClans try { SaveWar(war); - await war.Channel.SendErrorAsync($"❗🔰**Claim from @{Bases[i].CallUser} for a war against {war.ShortPrint()} has expired.**").ConfigureAwait(false); + await war.Channel.SendErrorAsync(GetTextStatic("claim_expired", + NadekoBot.Localization.GetCultureInfo(war.Channel.GuildId), + typeof(ClashOfClans).Name.ToLowerInvariant(), + Format.Bold(Bases[i].CallUser), + war.ShortPrint())); } catch { } } @@ -92,7 +96,7 @@ namespace NadekoBot.Modules.ClashOfClans if (size < 10 || size > 50 || size % 5 != 0) { - await Context.Channel.SendErrorAsync("🔰 Not a Valid war size").ConfigureAwait(false); + await ReplyErrorLocalized("invalid_size").ConfigureAwait(false); return; } List wars; @@ -107,7 +111,7 @@ namespace NadekoBot.Modules.ClashOfClans var cw = await CreateWar(enemyClan, size, Context.Guild.Id, Context.Channel.Id); wars.Add(cw); - await Context.Channel.SendConfirmAsync($"❗🔰**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**").ConfigureAwait(false); + await ReplyErrorLocalized("war_created", cw.ShortPrint()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -120,18 +124,18 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(Context.Guild, num); if (warsInfo == null) { - await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false); + await ReplyErrorLocalized("war_not_exist").ConfigureAwait(false); return; } var war = warsInfo.Item1[warsInfo.Item2]; try { war.Start(); - await Context.Channel.SendConfirmAsync($"🔰**STARTED WAR AGAINST {war.ShortPrint()}**").ConfigureAwait(false); + await ReplyConfirmLocalized("war_started", war.ShortPrint()).ConfigureAwait(false); } catch { - await Context.Channel.SendErrorAsync($"🔰**WAR AGAINST {war.ShortPrint()} HAS ALREADY STARTED**").ConfigureAwait(false); + await ReplyErrorLocalized("war_already_started", war.ShortPrint()).ConfigureAwait(false); } SaveWar(war); } @@ -149,22 +153,20 @@ namespace NadekoBot.Modules.ClashOfClans ClashWars.TryGetValue(Context.Guild.Id, out wars); if (wars == null || wars.Count == 0) { - await Context.Channel.SendErrorAsync("🔰 **No active wars.**").ConfigureAwait(false); + await ReplyErrorLocalized("no_active_wars").ConfigureAwait(false); return; } var sb = new StringBuilder(); - sb.AppendLine("🔰 **LIST OF ACTIVE WARS**"); sb.AppendLine("**-------------------------**"); for (var i = 0; i < wars.Count; i++) { - sb.AppendLine($"**#{i + 1}.** `Enemy:` **{wars[i].EnemyClan}**"); - sb.AppendLine($"\t\t`Size:` **{wars[i].Size} v {wars[i].Size}**"); + sb.AppendLine($"**#{i + 1}.** `{GetText("enemy")}:` **{wars[i].EnemyClan}**"); + sb.AppendLine($"\t\t`{GetText("size")}:` **{wars[i].Size} v {wars[i].Size}**"); sb.AppendLine("**-------------------------**"); } - await Context.Channel.SendConfirmAsync(sb.ToString()).ConfigureAwait(false); + await Context.Channel.SendConfirmAsync(GetText("list_active_wars"), sb.ToString()).ConfigureAwait(false); return; - } var num = 0; int.TryParse(number, out num); @@ -172,10 +174,11 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(Context.Guild, num); if (warsInfo == null) { - await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false); + await ReplyErrorLocalized("war_not_exist").ConfigureAwait(false); return; } - await Context.Channel.SendConfirmAsync(warsInfo.Item1[warsInfo.Item2].ToPrettyString()).ConfigureAwait(false); + var war = warsInfo.Item1[warsInfo.Item2]; + await Context.Channel.SendConfirmAsync(war.Localize("info_about_war", $"`{war.EnemyClan}` ({war.Size} v {war.Size})"), war.ToPrettyString()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -185,7 +188,7 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(Context.Guild, number); if (warsInfo == null || warsInfo.Item1.Count == 0) { - await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false); + await ReplyErrorLocalized("war_not_exist").ConfigureAwait(false); return; } var usr = @@ -197,11 +200,11 @@ namespace NadekoBot.Modules.ClashOfClans var war = warsInfo.Item1[warsInfo.Item2]; war.Call(usr, baseNumber - 1); SaveWar(war); - await Context.Channel.SendConfirmAsync($"🔰**{usr}** claimed a base #{baseNumber} for a war against {war.ShortPrint()}").ConfigureAwait(false); + await ConfirmLocalized("claimed_base", Format.Bold(usr.ToString()), baseNumber, war.ShortPrint()).ConfigureAwait(false); } catch (Exception ex) { - await Context.Channel.SendErrorAsync($"🔰 {ex.Message}").ConfigureAwait(false); + await Context.Channel.SendErrorAsync(ex.Message).ConfigureAwait(false); } } @@ -233,13 +236,13 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(Context.Guild, number); if (warsInfo == null) { - await Context.Channel.SendErrorAsync("🔰 That war does not exist.").ConfigureAwait(false); + await ReplyErrorLocalized("war_not_exist").ConfigureAwait(false); return; } var war = warsInfo.Item1[warsInfo.Item2]; war.End(); SaveWar(war); - await Context.Channel.SendConfirmAsync($"❗🔰**War against {warsInfo.Item1[warsInfo.Item2].ShortPrint()} ended.**").ConfigureAwait(false); + await ReplyConfirmLocalized("war_ended", warsInfo.Item1[warsInfo.Item2].ShortPrint()).ConfigureAwait(false); var size = warsInfo.Item1[warsInfo.Item2].Size; warsInfo.Item1.RemoveAt(warsInfo.Item2); @@ -252,7 +255,7 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(Context.Guild, number); if (warsInfo == null || warsInfo.Item1.Count == 0) { - await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false); + await ReplyErrorLocalized("war_not_exist").ConfigureAwait(false); return; } var usr = @@ -264,11 +267,11 @@ namespace NadekoBot.Modules.ClashOfClans var war = warsInfo.Item1[warsInfo.Item2]; var baseNumber = war.Uncall(usr); SaveWar(war); - await Context.Channel.SendConfirmAsync($"🔰 @{usr} has **UNCLAIMED** a base #{baseNumber + 1} from a war against {war.ShortPrint()}").ConfigureAwait(false); + await ReplyConfirmLocalized("base_unclaimed", usr, baseNumber + 1, war.ShortPrint()).ConfigureAwait(false); } catch (Exception ex) { - await Context.Channel.SendErrorAsync($"🔰 {ex.Message}").ConfigureAwait(false); + await Context.Channel.SendErrorAsync(ex.Message).ConfigureAwait(false); } } @@ -277,7 +280,7 @@ namespace NadekoBot.Modules.ClashOfClans var warInfo = GetWarInfo(Context.Guild, number); if (warInfo == null || warInfo.Item1.Count == 0) { - await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false); + await ReplyErrorLocalized("war_not_exist").ConfigureAwait(false); return; } var war = warInfo.Item1[warInfo.Item2]; @@ -292,7 +295,7 @@ namespace NadekoBot.Modules.ClashOfClans { war.FinishClaim(baseNumber, stars); } - await Context.Channel.SendConfirmAsync($"❗🔰{Context.User.Mention} **DESTROYED** a base #{baseNumber + 1} in a war against {war.ShortPrint()}").ConfigureAwait(false); + await ReplyConfirmLocalized("base_destroyed", baseNumber +1, war.ShortPrint()).ConfigureAwait(false); } catch (Exception ex) { diff --git a/src/NadekoBot/Modules/ClashOfClans/Extensions.cs b/src/NadekoBot/Modules/ClashOfClans/Extensions.cs index de12bcab..032d3bcd 100644 --- a/src/NadekoBot/Modules/ClashOfClans/Extensions.cs +++ b/src/NadekoBot/Modules/ClashOfClans/Extensions.cs @@ -27,13 +27,13 @@ namespace NadekoBot.Modules.ClashOfClans public static void Call(this ClashWar cw, string u, int baseNumber) { if (baseNumber < 0 || baseNumber >= cw.Bases.Count) - throw new ArgumentException("Invalid base number"); + throw new ArgumentException(cw.Localize("invalid_base_number")); if (cw.Bases[baseNumber].CallUser != null && cw.Bases[baseNumber].Stars == 3) - throw new ArgumentException("That base is already destroyed."); + throw new ArgumentException(cw.Localize("base_already_claimed")); for (var i = 0; i < cw.Bases.Count; i++) { if (cw.Bases[i]?.BaseDestroyed == false && cw.Bases[i]?.CallUser == u) - throw new ArgumentException($"@{u} You already claimed base #{i + 1}. You can't claim a new one."); + throw new ArgumentException(cw.Localize("claimed_other", u, i + 1)); } var cc = cw.Bases[baseNumber]; @@ -45,7 +45,7 @@ namespace NadekoBot.Modules.ClashOfClans public static void Start(this ClashWar cw) { if (cw.WarState == StateOfWar.Started) - throw new InvalidOperationException("War already started"); + throw new InvalidOperationException("war_already_started"); //if (Started) // throw new InvalidOperationException(); //Started = true; @@ -66,7 +66,7 @@ namespace NadekoBot.Modules.ClashOfClans cw.Bases[i].CallUser = null; return i; } - throw new InvalidOperationException("You are not participating in that war."); + throw new InvalidOperationException(cw.Localize("not_partic")); } public static string ShortPrint(this ClashWar cw) => @@ -75,8 +75,7 @@ namespace NadekoBot.Modules.ClashOfClans public static string ToPrettyString(this ClashWar cw) { var sb = new StringBuilder(); - - sb.AppendLine($"🔰**WAR AGAINST `{cw.EnemyClan}` ({cw.Size} v {cw.Size}) INFO:**"); + if (cw.WarState == StateOfWar.Created) sb.AppendLine("`not started`"); var twoHours = new TimeSpan(2, 0, 0); @@ -84,7 +83,7 @@ namespace NadekoBot.Modules.ClashOfClans { if (cw.Bases[i].CallUser == null) { - sb.AppendLine($"`{i + 1}.` ❌*unclaimed*"); + sb.AppendLine($"`{i + 1}.` ❌*{cw.Localize("not_claimed")}*"); } else { @@ -120,7 +119,7 @@ namespace NadekoBot.Modules.ClashOfClans cw.Bases[i].Stars = stars; return i; } - throw new InvalidOperationException($"@{user} You are either not participating in that war, or you already destroyed a base."); + throw new InvalidOperationException(cw.Localize("not_partic_or_destroyed", user)); } public static void FinishClaim(this ClashWar cw, int index, int stars = 3) @@ -128,10 +127,22 @@ namespace NadekoBot.Modules.ClashOfClans if (index < 0 || index > cw.Bases.Count) throw new ArgumentOutOfRangeException(nameof(index)); var toFinish = cw.Bases[index]; - if (toFinish.BaseDestroyed != false) throw new InvalidOperationException("That base is already destroyed."); - if (toFinish.CallUser == null) throw new InvalidOperationException("That base is unclaimed."); + if (toFinish.BaseDestroyed != false) throw new InvalidOperationException(cw.Localize("base_already_destroyed")); + if (toFinish.CallUser == null) throw new InvalidOperationException(cw.Localize("base_already_unclaimed")); toFinish.BaseDestroyed = true; toFinish.Stars = stars; } + + public static string Localize(this ClashWar cw, string key) + { + return NadekoModule.GetTextStatic(key, + NadekoBot.Localization.GetCultureInfo(cw.Channel?.GuildId), + typeof(ClashOfClans).Name.ToLowerInvariant()); + } + + public static string Localize(this ClashWar cw, string key, params object[] replacements) + { + return string.Format(cw.Localize(key), replacements); + } } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Games/Commands/PlantAndPickCommands.cs b/src/NadekoBot/Modules/Games/Commands/PlantAndPickCommands.cs index 234da7c2..f664a7f2 100644 --- a/src/NadekoBot/Modules/Games/Commands/PlantAndPickCommands.cs +++ b/src/NadekoBot/Modules/Games/Commands/PlantAndPickCommands.cs @@ -222,17 +222,6 @@ namespace NadekoBot.Modules.Games return images[rng.Next(0, images.Length)]; } - - int GetRandomNumber() - { - using (var rg = RandomNumberGenerator.Create()) - { - byte[] rno = new byte[4]; - rg.GetBytes(rno); - int randomvalue = BitConverter.ToInt32(rno, 0); - return randomvalue; - } - } } } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/NadekoModule.cs b/src/NadekoBot/Modules/NadekoModule.cs index 9311dac5..7ef213db 100644 --- a/src/NadekoBot/Modules/NadekoModule.cs +++ b/src/NadekoBot/Modules/NadekoModule.cs @@ -13,7 +13,7 @@ namespace NadekoBot.Modules { protected readonly Logger _log; protected CultureInfo _cultureInfo { get; private set; } - public readonly string _prefix; + public readonly string Prefix; public readonly string ModuleTypeName; public readonly string LowerModuleTypeName; @@ -23,16 +23,14 @@ namespace NadekoBot.Modules ModuleTypeName = isTopLevelModule ? this.GetType().Name : this.GetType().DeclaringType.Name; LowerModuleTypeName = ModuleTypeName.ToLowerInvariant(); - if (!NadekoBot.ModulePrefixes.TryGetValue(ModuleTypeName, out _prefix)) - _prefix = "?err?"; + if (!NadekoBot.ModulePrefixes.TryGetValue(ModuleTypeName, out Prefix)) + Prefix = "?err?"; _log = LogManager.GetCurrentClassLogger(); } protected override void BeforeExecute() { - _cultureInfo = (Context.Guild == null - ? NadekoBot.Localization.DefaultCultureInfo - : NadekoBot.Localization.GetCultureInfo(Context.Guild)); + _cultureInfo = NadekoBot.Localization.GetCultureInfo(Context.Guild?.Id); _log.Warn("Culture info is {0}", _cultureInfo); } @@ -60,24 +58,31 @@ namespace NadekoBot.Modules /// /// Used as failsafe in case response key doesn't exist in the selected or default language. /// - private readonly CultureInfo usCultureInfo = new CultureInfo("en-US"); - protected string GetText(string key) + private static readonly CultureInfo usCultureInfo = new CultureInfo("en-US"); + + public static string GetTextStatic(string key, CultureInfo _cultureInfo, string lowerModuleTypeName) { - var text = NadekoBot.ResponsesResourceManager.GetString(LowerModuleTypeName + "_" + key, _cultureInfo); + var text = NadekoBot.ResponsesResourceManager.GetString(lowerModuleTypeName + "_" + key, _cultureInfo); if (string.IsNullOrWhiteSpace(text)) { - _log.Warn(LowerModuleTypeName + "_" + key + " key is missing from " + _cultureInfo + " response strings. PLEASE REPORT THIS."); - return NadekoBot.ResponsesResourceManager.GetString(LowerModuleTypeName + "_" + key, usCultureInfo); + LogManager.GetCurrentClassLogger().Warn(lowerModuleTypeName + "_" + key + " key is missing from " + _cultureInfo + " response strings. PLEASE REPORT THIS."); + return NadekoBot.ResponsesResourceManager.GetString(lowerModuleTypeName + "_" + key, usCultureInfo) ?? $"Error: dkey {lowerModuleTypeName + "_" + key} found!"; } - return text; + return text ?? $"Error: key {lowerModuleTypeName + "_" + key} not found."; } - protected string GetText(string key, params object[] replacements) + public static string GetTextStatic(string key, CultureInfo _cultureInfo, string lowerModuleTypeName, params object[] replacements) { - return string.Format(GetText(key), replacements); + return string.Format(GetTextStatic(key, _cultureInfo, lowerModuleTypeName), replacements); } + protected string GetText(string key) => + GetTextStatic(key, _cultureInfo, LowerModuleTypeName); + + protected string GetText(string key, params object[] replacements) => + GetText(key, _cultureInfo, LowerModuleTypeName, replacements); + public Task ErrorLocalized(string textKey, params object[] replacements) { var text = GetText(textKey); diff --git a/src/NadekoBot/Modules/Pokemon/Pokemon.cs b/src/NadekoBot/Modules/Pokemon/Pokemon.cs index a95a6d5f..e2679147 100644 --- a/src/NadekoBot/Modules/Pokemon/Pokemon.cs +++ b/src/NadekoBot/Modules/Pokemon/Pokemon.cs @@ -153,7 +153,7 @@ namespace NadekoBot.Modules.Pokemon var enabledMoves = userType.Moves; if (!enabledMoves.Contains(move.ToLowerInvariant())) { - await ReplyErrorLocalized("invalid_move", Format.Bold(move), _prefix).ConfigureAwait(false); + await ReplyErrorLocalized("invalid_move", Format.Bold(move), Prefix).ConfigureAwait(false); return; } diff --git a/src/NadekoBot/Resources/ResponseStrings.Designer.cs b/src/NadekoBot/Resources/ResponseStrings.Designer.cs index 337d3b62..3b58fbab 100644 --- a/src/NadekoBot/Resources/ResponseStrings.Designer.cs +++ b/src/NadekoBot/Resources/ResponseStrings.Designer.cs @@ -59,6 +59,213 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to That base is already claimed or destroyed.. + /// + public static string clashofclans_base_already_claimed { + get { + return ResourceManager.GetString("clashofclans_base_already_claimed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to That base is already destroyed.. + /// + public static string clashofclans_base_already_destroyed { + get { + return ResourceManager.GetString("clashofclans_base_already_destroyed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to That base is not claimed.. + /// + public static string clashofclans_base_already_unclaimed { + get { + return ResourceManager.GetString("clashofclans_base_already_unclaimed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to **DESTROYED** base #{0} in a war against {1}. + /// + public static string clashofclans_base_destroyed { + get { + return ResourceManager.GetString("clashofclans_base_destroyed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} has **UNCLAIMED** base #{1} in a war against {2}. + /// + public static string clashofclans_base_unclaimed { + get { + return ResourceManager.GetString("clashofclans_base_unclaimed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Claim from @{0} for a war against {1} has expired.. + /// + public static string clashofclans_claim_expired { + get { + return ResourceManager.GetString("clashofclans_claim_expired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} claimed a base #{1} in a war against {2}. + /// + public static string clashofclans_claimed_base { + get { + return ResourceManager.GetString("clashofclans_claimed_base", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to @{0} You already claimed base #{1}. You can't claim a new one.. + /// + public static string clashofclans_claimed_other { + get { + return ResourceManager.GetString("clashofclans_claimed_other", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enemy. + /// + public static string clashofclans_enemy { + get { + return ResourceManager.GetString("clashofclans_enemy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Info about war against {0}. + /// + public static string clashofclans_info_about_war { + get { + return ResourceManager.GetString("clashofclans_info_about_war", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid base number.. + /// + public static string clashofclans_invalid_base_number { + get { + return ResourceManager.GetString("clashofclans_invalid_base_number", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not a Valid war size.. + /// + public static string clashofclans_invalid_size { + get { + return ResourceManager.GetString("clashofclans_invalid_size", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List Of Active Wars. + /// + public static string clashofclans_list_active_wars { + get { + return ResourceManager.GetString("clashofclans_list_active_wars", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No active wars.. + /// + public static string clashofclans_no_active_wars { + get { + return ResourceManager.GetString("clashofclans_no_active_wars", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to not claimed. + /// + public static string clashofclans_not_claimed { + get { + return ResourceManager.GetString("clashofclans_not_claimed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You are not participating in that war.. + /// + public static string clashofclans_not_partic { + get { + return ResourceManager.GetString("clashofclans_not_partic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to @{0} You are either not participating in that war, or that base is already destroyed.. + /// + public static string clashofclans_not_partic_or_destroyed { + get { + return ResourceManager.GetString("clashofclans_not_partic_or_destroyed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Size. + /// + public static string clashofclans_size { + get { + return ResourceManager.GetString("clashofclans_size", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to War against {0} has already started.. + /// + public static string clashofclans_war_already_started { + get { + return ResourceManager.GetString("clashofclans_war_already_started", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to War against {0} created.. + /// + public static string clashofclans_war_created { + get { + return ResourceManager.GetString("clashofclans_war_created", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to War against {0} ended.. + /// + public static string clashofclans_war_ended { + get { + return ResourceManager.GetString("clashofclans_war_ended", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to That war does not exist.. + /// + public static string clashofclans_war_not_exist { + get { + return ResourceManager.GetString("clashofclans_war_not_exist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to War against {0} started!. + /// + public static string clashofclans_war_started { + get { + return ResourceManager.GetString("clashofclans_war_started", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} has already fainted.. /// diff --git a/src/NadekoBot/Resources/ResponseStrings.resx b/src/NadekoBot/Resources/ResponseStrings.resx index 63ef2430..155460f7 100644 --- a/src/NadekoBot/Resources/ResponseStrings.resx +++ b/src/NadekoBot/Resources/ResponseStrings.resx @@ -117,6 +117,75 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + That base is already claimed or destroyed. + + + That base is already destroyed. + + + That base is not claimed. + + + **DESTROYED** base #{0} in a war against {1} + + + {0} has **UNCLAIMED** base #{1} in a war against {2} + + + {0} claimed a base #{1} in a war against {2} + + + @{0} You already claimed base #{1}. You can't claim a new one. + + + Claim from @{0} for a war against {1} has expired. + + + Enemy + + + Info about war against {0} + + + Invalid base number. + + + Not a Valid war size. + + + List Of Active Wars + + + not claimed + + + You are not participating in that war. + + + @{0} You are either not participating in that war, or you have already destroyed a base. + + + No active wars. + + + Size + + + War against {0} is already started. + + + War against {0} created. + + + War against {0} ended. + + + That war does not exist. + + + War against {0} started! + {0} has already fainted. diff --git a/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx b/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx index 218a7645..43a96f10 100644 --- a/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx +++ b/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx @@ -184,4 +184,73 @@ Онесвешћен си, не можеш да се крећеш. + + Та база је већ под захетвом или је уништена. + + + Та база је већ под захтевом. + + + Та база није под захтевом. + + + {0} је **ПОНИШТИО ЗАХТЕВ** за базу #{1} у рату против {2} + + + {0} захтева базу #{1} у рату против {2} + + + @{0} Ти већ захтеваш базу #{1}. Не можеш захтевати још једну. + + + Захтев од @{0} за рат против {1} је истекао. + + + Противник + + + Подаци о рату против {0} + + + Број базе није валидан. + + + Величина рата није валидна. + + + Листа Ратова У Току + + + нема захтева + + + Ти не учествујеш у том рату. + + + @{0} Ти или не учествујеш у рату или је та база већ уништена. + + + Нема ратова у току. + + + Величина + + + Рат против {0} је већ почео. + + + Рат против {0} је направљен. + + + Рат против {0} је завршен. + + + Тај рат не постоји. + + + Рат против {0} је започет! + + + је **УНИШТИО** базу #{0} у рату против {1} + \ No newline at end of file diff --git a/src/NadekoBot/Services/Impl/Localization.cs b/src/NadekoBot/Services/Impl/Localization.cs index e4906712..e9d792ca 100644 --- a/src/NadekoBot/Services/Impl/Localization.cs +++ b/src/NadekoBot/Services/Impl/Localization.cs @@ -102,12 +102,14 @@ namespace NadekoBot.Services SetDefaultCulture(CultureInfo.CurrentCulture); public CultureInfo GetCultureInfo(IGuild guild) => - GetCultureInfo(guild.Id); + GetCultureInfo(guild?.Id); - public CultureInfo GetCultureInfo(ulong guildId) + public CultureInfo GetCultureInfo(ulong? guildId) { + if (guildId == null) + return DefaultCultureInfo; CultureInfo info = null; - GuildCultureInfos.TryGetValue(guildId, out info); + GuildCultureInfos.TryGetValue(guildId.Value, out info); return info ?? DefaultCultureInfo; }