From 5cb74690284105db70a467ab77c2af3f44e42348 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 5 Nov 2017 16:51:23 -0500 Subject: support track selection before playback --- .../Localization/LocalizationManager.cs | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) (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 2eb4743cd..6d271c0e1 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Localization var localizationPath = LocalizationPath; - _fileSystem.CreateDirectory(localizationPath); + _fileSystem.CreateDirectory(localizationPath); var existingFiles = GetRatingsFiles(localizationPath) .Select(Path.GetFileName) @@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.Localization } } } - + foreach (var file in GetRatingsFiles(localizationPath)) { LoadRatings(file); @@ -128,12 +128,20 @@ namespace Emby.Server.Implementations.Localization return _textLocalizer.NormalizeFormKD(text); } + private CultureDto[] _cultures; + /// /// Gets the cultures. /// /// IEnumerable{CultureDto}. public CultureDto[] GetCultures() { + var result = _cultures; + if (result != null) + { + return result; + } + var type = GetType(); var path = type.Namespace + ".iso6392.txt"; @@ -166,10 +174,14 @@ namespace Emby.Server.Implementations.Localization } } - return list.Where(i => !string.IsNullOrWhiteSpace(i.Name) && - !string.IsNullOrWhiteSpace(i.DisplayName) && - !string.IsNullOrWhiteSpace(i.ThreeLetterISOLanguageName) && - !string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray(); + result = list.Where(i => !string.IsNullOrWhiteSpace(i.Name) && + !string.IsNullOrWhiteSpace(i.DisplayName) && + !string.IsNullOrWhiteSpace(i.ThreeLetterISOLanguageName) && + !string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray(); + + _cultures = result; + + return result; } /// @@ -239,7 +251,7 @@ namespace Emby.Server.Implementations.Localization /// Dictionary{System.StringParentalRating}. private void LoadRatings(string file) { - var dict = _fileSystem.ReadAllLines(file).Select(i => + var dict = _fileSystem.ReadAllLines(file).Select(i => { if (!string.IsNullOrWhiteSpace(i)) { @@ -269,7 +281,7 @@ namespace Emby.Server.Implementations.Localization _allParentalRatings.TryAdd(countryCode, dict); } - private readonly string[] _unratedValues = {"n/a", "unrated", "not rated"}; + private readonly string[] _unratedValues = { "n/a", "unrated", "not rated" }; /// /// Gets the rating level. -- cgit v1.2.3