From e7ecd418c43b966bac3c34d09e6f97c1176a749c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 21 Oct 2017 12:39:52 -0400 Subject: update home video library support --- .../Localization/LocalizationManager.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'Emby.Server.Implementations/Localization/LocalizationManager.cs') 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> _dictionaries = new ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase); public Dictionary 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 GetDictionary(string prefix, string culture, string baseFilename) { + if (string.IsNullOrWhiteSpace(culture)) + { + throw new ArgumentNullException("culture"); + } + var dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); var namespaceName = GetType().Namespace + "." + prefix; -- cgit v1.2.3