diff --git a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs index 4bd4c7b3..abfdb33f 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs @@ -14,6 +14,8 @@ public class LocaleService( ) { protected readonly LocaleConfig _localeConfig = _configServer.GetConfig(); + private string _chosenServerLocale = string.Empty; + private string _chosenClientLocale = string.Empty; /// /// Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' @@ -68,9 +70,14 @@ public class LocaleService( /// Locale e.g en/ge/cz/cn public string GetDesiredGameLocale() { - return string.Equals(_localeConfig.GameLocale, "system", StringComparison.OrdinalIgnoreCase) - ? GetPlatformForClientLocale() - : _localeConfig.GameLocale.ToLower(); // Use custom locale value + if (string.IsNullOrEmpty(_chosenClientLocale)) + { + _chosenClientLocale = string.Equals(_localeConfig.GameLocale, "system", StringComparison.OrdinalIgnoreCase) + ? GetPlatformForClientLocale() + : _localeConfig.GameLocale.ToLower(); // Use custom locale value + } + + return _chosenClientLocale; } /// @@ -80,13 +87,18 @@ public class LocaleService( /// Locale e.g en/ge/cz/cn public string GetDesiredServerLocale() { - return string.Equals( - _localeConfig.ServerLocale, - "system", - StringComparison.OrdinalIgnoreCase - ) - ? GetPlatformForServerLocale() - : _localeConfig.ServerLocale.ToLower(); // Use custom locale value + if (!string.IsNullOrEmpty(_chosenServerLocale)) + { + _chosenServerLocale = string.Equals( + _localeConfig.ServerLocale, + "system", + StringComparison.OrdinalIgnoreCase + ) + ? GetPlatformForServerLocale() + : _localeConfig.ServerLocale.ToLower(); // Use custom locale value + } + + return _chosenServerLocale; } ///