mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-02-06 04:53:39 +00:00
Respect CurrentCulture also in CG
This commit is contained in:
@@ -168,6 +168,15 @@ namespace ConfigGenerator.Localization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Your provided CurrentCulture is invalid, ConfigGenerator will keep running with default one!.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ErrorInvalidCurrentCulture {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ErrorInvalidCurrentCulture", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to This name is already used!.
|
/// Looks up a localized string similar to This name is already used!.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -154,6 +154,9 @@
|
|||||||
<value>Configured {0} property is invalid: {1}</value>
|
<value>Configured {0} property is invalid: {1}</value>
|
||||||
<comment>{0} will be replaced by name of the configuration property, {1} will be replaced by invalid value</comment>
|
<comment>{0} will be replaced by name of the configuration property, {1} will be replaced by invalid value</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ErrorInvalidCurrentCulture" xml:space="preserve">
|
||||||
|
<value>Your provided CurrentCulture is invalid, ConfigGenerator will keep running with default one!</value>
|
||||||
|
</data>
|
||||||
<data name="ErrorNameAlreadyUsed" xml:space="preserve">
|
<data name="ErrorNameAlreadyUsed" xml:space="preserve">
|
||||||
<value>This name is already used!</value>
|
<value>This name is already used!</value>
|
||||||
<comment>This happens e.g. when user wants to create a bot with name that exists already</comment>
|
<comment>This happens e.g. when user wants to create a bot with name that exists already</comment>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -64,8 +65,18 @@ namespace ConfigGenerator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASFTab = new ConfigPage(GlobalConfig.Load(Path.Combine(SharedInfo.ConfigDirectory, SharedInfo.GlobalConfigFileName)));
|
GlobalConfig globalConfig = GlobalConfig.Load(Path.Combine(SharedInfo.ConfigDirectory, SharedInfo.GlobalConfigFileName));
|
||||||
|
if (!string.IsNullOrEmpty(globalConfig.CurrentCulture)) {
|
||||||
|
try {
|
||||||
|
// GetCultureInfo() would be better but we can't use it for specifying neutral cultures such as "en"
|
||||||
|
CultureInfo culture = CultureInfo.CreateSpecificCulture(globalConfig.CurrentCulture);
|
||||||
|
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture = culture;
|
||||||
|
} catch (CultureNotFoundException) {
|
||||||
|
Logging.LogGenericErrorWithoutStacktrace(CGStrings.ErrorInvalidCurrentCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ASFTab = new ConfigPage(globalConfig);
|
||||||
MainTab.TabPages.Add(ASFTab);
|
MainTab.TabPages.Add(ASFTab);
|
||||||
|
|
||||||
foreach (string configFile in Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*.json")) {
|
foreach (string configFile in Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*.json")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user