aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Localization/LocalizationManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-11-05 16:51:23 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-11-05 16:51:23 -0500
commit5cb74690284105db70a467ab77c2af3f44e42348 (patch)
tree0e37b05d34dbcbe3d08d0c74229287cd0cd6f496 /Emby.Server.Implementations/Localization/LocalizationManager.cs
parentb9c1f61681de23d95de7c6b392eb3e55670991da (diff)
support track selection before playback
Diffstat (limited to 'Emby.Server.Implementations/Localization/LocalizationManager.cs')
-rw-r--r--Emby.Server.Implementations/Localization/LocalizationManager.cs28
1 files changed, 20 insertions, 8 deletions
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;
+
/// <summary>
/// Gets the cultures.
/// </summary>
/// <returns>IEnumerable{CultureDto}.</returns>
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;
}
/// <summary>
@@ -239,7 +251,7 @@ namespace Emby.Server.Implementations.Localization
/// <returns>Dictionary{System.StringParentalRating}.</returns>
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" };
/// <summary>
/// Gets the rating level.