diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-10-21 12:39:52 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-10-21 12:39:52 -0400 |
| commit | e7ecd418c43b966bac3c34d09e6f97c1176a749c (patch) | |
| tree | 00e9fbb89b26ad38cc8a8c867bb2ea6413e53c15 /Emby.Server.Implementations/Localization/LocalizationManager.cs | |
| parent | 0cf4f01dc72b3775e3af067ed1eef51c683a3c02 (diff) | |
update home video library support
Diffstat (limited to 'Emby.Server.Implementations/Localization/LocalizationManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Localization/LocalizationManager.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 48df96289..650f388a1 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -319,6 +319,10 @@ namespace Emby.Server.Implementations.Localization { culture = _configurationManager.Configuration.UICulture; } + if (string.IsNullOrWhiteSpace(culture)) + { + culture = DefaultCulture; + } var dictionary = GetLocalizationDictionary(culture); @@ -332,19 +336,31 @@ namespace Emby.Server.Implementations.Localization return phrase; } + const string DefaultCulture = "en-US"; + private readonly ConcurrentDictionary<string, Dictionary<string, string>> _dictionaries = new ConcurrentDictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase); public Dictionary<string, string> GetLocalizationDictionary(string culture) { + if (string.IsNullOrWhiteSpace(culture)) + { + throw new ArgumentNullException("culture"); + } + const string prefix = "Core"; var key = prefix + culture; - return _dictionaries.GetOrAdd(key, k => GetDictionary(prefix, culture, "en-US.json")); + return _dictionaries.GetOrAdd(key, k => GetDictionary(prefix, culture, DefaultCulture + ".json")); } private Dictionary<string, string> GetDictionary(string prefix, string culture, string baseFilename) { + if (string.IsNullOrWhiteSpace(culture)) + { + throw new ArgumentNullException("culture"); + } + var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); var namespaceName = GetType().Namespace + "." + prefix; |
