diff --git a/AutoUpdate/SingleAssemblyResourceManager.cs b/AutoUpdate/SingleAssemblyResourceManager.cs index b7d6321317..1b135e55ab 100644 --- a/AutoUpdate/SingleAssemblyResourceManager.cs +++ b/AutoUpdate/SingleAssemblyResourceManager.cs @@ -19,7 +19,7 @@ protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { ResourceSet rs; - if (!myResourceSets.TryGetValue(culture, out rs)) + if (!myResourceSets.TryGetValue(culture, out rs) && createIfNotExists) { // Lazy-load default language (without caring about duplicate assignment in race conditions, no harm done) if (neutralResourcesCulture == null) diff --git a/Cmdline/SingleAssemblyResourceManager.cs b/Cmdline/SingleAssemblyResourceManager.cs index f7345f9aac..a440814d45 100644 --- a/Cmdline/SingleAssemblyResourceManager.cs +++ b/Cmdline/SingleAssemblyResourceManager.cs @@ -19,7 +19,7 @@ protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { ResourceSet rs; - if (!myResourceSets.TryGetValue(culture, out rs)) + if (!myResourceSets.TryGetValue(culture, out rs) && createIfNotExists) { // Lazy-load default language (without caring about duplicate assignment in race conditions, no harm done) if (neutralResourcesCulture == null) diff --git a/ConsoleUI/SingleAssemblyResourceManager.cs b/ConsoleUI/SingleAssemblyResourceManager.cs index 3f512754b8..6618b92b33 100644 --- a/ConsoleUI/SingleAssemblyResourceManager.cs +++ b/ConsoleUI/SingleAssemblyResourceManager.cs @@ -19,7 +19,7 @@ protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { ResourceSet rs; - if (!myResourceSets.TryGetValue(culture, out rs)) + if (!myResourceSets.TryGetValue(culture, out rs) && createIfNotExists) { // Lazy-load default language (without caring about duplicate assignment in race conditions, no harm done) if (neutralResourcesCulture == null) diff --git a/Core/SingleAssemblyResourceManager.cs b/Core/SingleAssemblyResourceManager.cs index 54cc5879d6..cae5e93cb9 100644 --- a/Core/SingleAssemblyResourceManager.cs +++ b/Core/SingleAssemblyResourceManager.cs @@ -19,7 +19,7 @@ protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { ResourceSet rs; - if (!myResourceSets.TryGetValue(culture, out rs)) + if (!myResourceSets.TryGetValue(culture, out rs) && createIfNotExists) { // Lazy-load default language (without caring about duplicate assignment in race conditions, no harm done) if (neutralResourcesCulture == null) diff --git a/GUI/CKAN-GUI.csproj b/GUI/CKAN-GUI.csproj index 681a127d2d..93c1c77959 100644 --- a/GUI/CKAN-GUI.csproj +++ b/GUI/CKAN-GUI.csproj @@ -1315,6 +1315,12 @@ ResXFileCodeGenerator Resources.Designer.cs + + CKAN.GUI.Properties.Resources.tr-TR.resources + Designer + ResXFileCodeGenerator + Resources.Designer.cs + RenameInstanceDialog.cs diff --git a/GUI/Controls/ManageMods.resx b/GUI/Controls/ManageMods.resx index b62693a070..4693f28ddb 100644 --- a/GUI/Controls/ManageMods.resx +++ b/GUI/Controls/ManageMods.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - Launch Game Refresh Add available updates diff --git a/GUI/Localization/de-DE/Main.de-DE.resx b/GUI/Localization/de-DE/Main.de-DE.resx index cac5ba90e7..9218c48bc2 100644 --- a/GUI/Localization/de-DE/Main.de-DE.resx +++ b/GUI/Localization/de-DE/Main.de-DE.resx @@ -120,9 +120,6 @@ 32 - - True - Datei Spielinstanzen verwalten Spieleverzeichnis öffnen diff --git a/GUI/Localization/de-DE/ManageMods.de-DE.resx b/GUI/Localization/de-DE/ManageMods.de-DE.resx index 0d60b95e76..82c46ce1e7 100644 --- a/GUI/Localization/de-DE/ManageMods.de-DE.resx +++ b/GUI/Localization/de-DE/ManageMods.de-DE.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - Spiel starten Aktualisieren Verfügbare Updates auswählen diff --git a/GUI/Localization/fr-FR/Main.fr-FR.resx b/GUI/Localization/fr-FR/Main.fr-FR.resx index 2b6297438a..f2dd23fc94 100644 --- a/GUI/Localization/fr-FR/Main.fr-FR.resx +++ b/GUI/Localization/fr-FR/Main.fr-FR.resx @@ -120,9 +120,6 @@ 32 - - True - &Fichier diff --git a/GUI/Localization/fr-FR/ManageMods.fr-FR.resx b/GUI/Localization/fr-FR/ManageMods.fr-FR.resx index 4b0fe3d61e..0d217393df 100644 --- a/GUI/Localization/fr-FR/ManageMods.fr-FR.resx +++ b/GUI/Localization/fr-FR/ManageMods.fr-FR.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - Lancer le Jeu diff --git a/GUI/Localization/it-IT/Main.it-IT.resx b/GUI/Localization/it-IT/Main.it-IT.resx index 6953cf2252..3c256803e6 100644 --- a/GUI/Localization/it-IT/Main.it-IT.resx +++ b/GUI/Localization/it-IT/Main.it-IT.resx @@ -120,9 +120,6 @@ 32 - - True - &File diff --git a/GUI/Localization/it-IT/ManageMods.it-IT.resx b/GUI/Localization/it-IT/ManageMods.it-IT.resx index c162d6113c..6975f2e677 100644 --- a/GUI/Localization/it-IT/ManageMods.it-IT.resx +++ b/GUI/Localization/it-IT/ManageMods.it-IT.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - Avvia Gioco diff --git a/GUI/Localization/ja-JP/Main.ja-JP.resx b/GUI/Localization/ja-JP/Main.ja-JP.resx index becb043970..31611ec13f 100644 --- a/GUI/Localization/ja-JP/Main.ja-JP.resx +++ b/GUI/Localization/ja-JP/Main.ja-JP.resx @@ -120,9 +120,6 @@ 32 - - True - ファイル インスタンスを管理 ゲームファイルの場所を開く diff --git a/GUI/Localization/ja-JP/ManageMods.ja-JP.resx b/GUI/Localization/ja-JP/ManageMods.ja-JP.resx index 5e4469a29f..c4a7ea5ae7 100644 --- a/GUI/Localization/ja-JP/ManageMods.ja-JP.resx +++ b/GUI/Localization/ja-JP/ManageMods.ja-JP.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - ゲームを起動 diff --git a/GUI/Localization/ko-KR/Main.ko-KR.resx b/GUI/Localization/ko-KR/Main.ko-KR.resx index d9be3808da..86458d0e3e 100644 --- a/GUI/Localization/ko-KR/Main.ko-KR.resx +++ b/GUI/Localization/ko-KR/Main.ko-KR.resx @@ -120,9 +120,6 @@ 32 - - True - 파일 diff --git a/GUI/Localization/ko-KR/ManageMods.ko-KR.resx b/GUI/Localization/ko-KR/ManageMods.ko-KR.resx index 73cf0f3ee8..dcd4a9191e 100644 --- a/GUI/Localization/ko-KR/ManageMods.ko-KR.resx +++ b/GUI/Localization/ko-KR/ManageMods.ko-KR.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - 게임 실행 diff --git a/GUI/Localization/pl-PL/Main.pl-PL.resx b/GUI/Localization/pl-PL/Main.pl-PL.resx index 5dad49f332..15df946690 100644 --- a/GUI/Localization/pl-PL/Main.pl-PL.resx +++ b/GUI/Localization/pl-PL/Main.pl-PL.resx @@ -120,9 +120,6 @@ 32 - - True - &Plik diff --git a/GUI/Localization/pl-PL/ManageMods.pl-PL.resx b/GUI/Localization/pl-PL/ManageMods.pl-PL.resx index c4737d7edd..6fe016a540 100644 --- a/GUI/Localization/pl-PL/ManageMods.pl-PL.resx +++ b/GUI/Localization/pl-PL/ManageMods.pl-PL.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - Uruchom grę diff --git a/GUI/Localization/pt-BR/Main.pt-BR.resx b/GUI/Localization/pt-BR/Main.pt-BR.resx index 8ed3f72e64..ed921af308 100644 --- a/GUI/Localization/pt-BR/Main.pt-BR.resx +++ b/GUI/Localization/pt-BR/Main.pt-BR.resx @@ -120,9 +120,6 @@ 32 - - True - Arquivo diff --git a/GUI/Localization/pt-BR/ManageMods.pt-BR.resx b/GUI/Localization/pt-BR/ManageMods.pt-BR.resx index 74eeb4c726..c00c1666f4 100644 --- a/GUI/Localization/pt-BR/ManageMods.pt-BR.resx +++ b/GUI/Localization/pt-BR/ManageMods.pt-BR.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - Abrir Jogo diff --git a/GUI/Localization/ru-RU/Main.ru-RU.resx b/GUI/Localization/ru-RU/Main.ru-RU.resx index d4349f5809..e46b2e8261 100644 --- a/GUI/Localization/ru-RU/Main.ru-RU.resx +++ b/GUI/Localization/ru-RU/Main.ru-RU.resx @@ -120,9 +120,6 @@ 32 - - True - &Файл diff --git a/GUI/Localization/ru-RU/ManageMods.ru-RU.resx b/GUI/Localization/ru-RU/ManageMods.ru-RU.resx index b467adb918..7033df82d3 100644 --- a/GUI/Localization/ru-RU/ManageMods.ru-RU.resx +++ b/GUI/Localization/ru-RU/ManageMods.ru-RU.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - Запустить игру diff --git a/GUI/Localization/zh-CN/EditModSearch.zh-CN.resx b/GUI/Localization/zh-CN/EditModSearch.zh-CN.resx index 43b1056b49..e9e46bbe1c 100644 --- a/GUI/Localization/zh-CN/EditModSearch.zh-CN.resx +++ b/GUI/Localization/zh-CN/EditModSearch.zh-CN.resx @@ -117,8 +117,5 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - 搜索: diff --git a/GUI/Localization/zh-CN/Main.zh-CN.resx b/GUI/Localization/zh-CN/Main.zh-CN.resx index e0afa2c709..ba87799dad 100644 --- a/GUI/Localization/zh-CN/Main.zh-CN.resx +++ b/GUI/Localization/zh-CN/Main.zh-CN.resx @@ -120,9 +120,6 @@ 32 - - True - 文件 管理游戏实例 打开游戏目录 diff --git a/GUI/Localization/zh-CN/ManageMods.zh-CN.resx b/GUI/Localization/zh-CN/ManageMods.zh-CN.resx index 7080247239..2bf424a17f 100644 --- a/GUI/Localization/zh-CN/ManageMods.zh-CN.resx +++ b/GUI/Localization/zh-CN/ManageMods.zh-CN.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - 启动游戏 刷新 添加可用更新 diff --git a/GUI/Main/Main.resx b/GUI/Main/Main.resx index 99d60b5d46..f65c263c74 100644 --- a/GUI/Main/Main.resx +++ b/GUI/Main/Main.resx @@ -120,9 +120,6 @@ 32 - - True - &File &Manage game instances &Open game directory diff --git a/GUI/Properties/Resources.tr-TR.resx b/GUI/Properties/Resources.tr-TR.resx new file mode 100644 index 0000000000..cae20605c4 --- /dev/null +++ b/GUI/Properties/Resources.tr-TR.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GUI/SingleAssemblyComponentResourceManager.cs b/GUI/SingleAssemblyComponentResourceManager.cs index 26869fa715..84a9caeeb3 100644 --- a/GUI/SingleAssemblyComponentResourceManager.cs +++ b/GUI/SingleAssemblyComponentResourceManager.cs @@ -21,7 +21,7 @@ protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { ResourceSet rs; - if (!myResourceSets.TryGetValue(culture, out rs)) + if (!myResourceSets.TryGetValue(culture, out rs) && createIfNotExists) { // Lazy-load default language (without caring about duplicate assignment in race conditions, no harm done) if (neutralResourcesCulture == null) diff --git a/GUI/SingleAssemblyResourceManager.cs b/GUI/SingleAssemblyResourceManager.cs index 39dbd44f9c..f704afcd98 100644 --- a/GUI/SingleAssemblyResourceManager.cs +++ b/GUI/SingleAssemblyResourceManager.cs @@ -19,7 +19,7 @@ protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { ResourceSet rs; - if (!myResourceSets.TryGetValue(culture, out rs)) + if (!myResourceSets.TryGetValue(culture, out rs) && createIfNotExists) { // Lazy-load default language (without caring about duplicate assignment in race conditions, no harm done) if (neutralResourcesCulture == null) diff --git a/Tests/GUI/ResourcesTests.cs b/Tests/GUI/ResourcesTests.cs index 12a5ab4db3..bd76d16178 100644 --- a/Tests/GUI/ResourcesTests.cs +++ b/Tests/GUI/ResourcesTests.cs @@ -3,6 +3,8 @@ using System.Resources; using System.ComponentModel; using System.Globalization; +using System.Collections; + using NUnit.Framework; namespace Tests.GUI @@ -17,17 +19,30 @@ public class ResourcesTests /// This test covers the GUI/Properties/Resources.resx files. /// [Test] - public void PropertiesResources_LanguageResource_NotSet() + public void PropertiesResources_AllLocales_LanguageNotSetAndAllStrings() { // Arrange ResourceManager resources = new CKAN.GUI.SingleAssemblyResourceManager( "CKAN.GUI.Properties.Resources", typeof(CKAN.GUI.Properties.Resources).Assembly); // Act/Assert - foreach (CultureInfo resourceCulture in cultures) + Assert.Multiple(() => { - Assert.IsNull(resources.GetObject("$this.Language", resourceCulture)); - } + foreach (CultureInfo resourceCulture in cultures) + { + Assert.IsNull(resources.GetObject("$this.Language", resourceCulture)); + + var resSet = resources.GetResourceSet(resourceCulture, false, false); + if (resSet != null) + { + foreach (DictionaryEntry entry in resSet) + { + Assert.IsInstanceOf(entry.Value, + $"Resource '{entry.Key}' in locale '{resourceCulture.Name}' is not a string"); + } + } + } + }); } /// @@ -75,16 +90,29 @@ public void PropertiesResources_LanguageResource_NotSet() TestCase(typeof(CKAN.GUI.SelectionDialog)), TestCase(typeof(CKAN.GUI.YesNoDialog)), ] - public void ControlOrDialog_LanguageResource_NotSet(Type t) + public void ControlOrDialog_AllLocales_LanguageNotSetAndAllStrings(Type t) { // Arrange ComponentResourceManager resources = new CKAN.GUI.SingleAssemblyComponentResourceManager(t); // Act/Assert - foreach (CultureInfo resourceCulture in cultures) + Assert.Multiple(() => { - Assert.IsNull(resources.GetObject("$this.Language", resourceCulture)); - } + foreach (CultureInfo resourceCulture in cultures) + { + Assert.IsNull(resources.GetObject("$this.Language", resourceCulture)); + + var resSet = resources.GetResourceSet(resourceCulture, false, false); + if (resSet != null) + { + foreach (DictionaryEntry entry in resSet) + { + Assert.IsInstanceOf(entry.Value, + $"Resource '{t.Name} {entry.Key}' in locale '{resourceCulture.Name}' is not a string"); + } + } + } + }); } // The cultures to test