diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-03-04 09:43:29 -0500 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-03-04 09:43:29 -0500 |
| commit | b4ca3a7ad94484fe73262a4de92c554e768ee891 (patch) | |
| tree | 21751cc3170fd1e9fd0974df059411ef4696a732 /MediaBrowser.Controller/Localization/LocalizedStrings.cs | |
| parent | 67b20fdf0f970041480b1ea7d08d80b72a394c51 (diff) | |
| parent | d3b9afef2f3895daf91056938a92d6f51c8c834b (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Conflicts:
MediaBrowser.Controller/Providers/FanartBaseProvider.cs
MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs
Diffstat (limited to 'MediaBrowser.Controller/Localization/LocalizedStrings.cs')
| -rw-r--r-- | MediaBrowser.Controller/Localization/LocalizedStrings.cs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/MediaBrowser.Controller/Localization/LocalizedStrings.cs b/MediaBrowser.Controller/Localization/LocalizedStrings.cs index 0d583641b..c7f4755b7 100644 --- a/MediaBrowser.Controller/Localization/LocalizedStrings.cs +++ b/MediaBrowser.Controller/Localization/LocalizedStrings.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.Logging; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Model.Logging; using System; using System.Collections.Concurrent; using System.Globalization; @@ -14,10 +15,8 @@ namespace MediaBrowser.Controller.Localization /// </summary> public class LocalizedStrings { - /// <summary> - /// The logger - /// </summary> - static internal ILogger Logger { get; set; } + internal static IServerApplicationPaths ApplicationPaths; + /// <summary> /// The base prefix /// </summary> @@ -31,17 +30,21 @@ namespace MediaBrowser.Controller.Localization /// </summary> private static LocalizedStrings _instance; + private IServerApplicationPaths _appPaths; + /// <summary> /// Gets the instance. /// </summary> /// <value>The instance.</value> - public static LocalizedStrings Instance { get { return _instance ?? (_instance = new LocalizedStrings()); } } + public static LocalizedStrings Instance { get { return _instance ?? (_instance = new LocalizedStrings(ApplicationPaths)); } } /// <summary> /// Initializes a new instance of the <see cref="LocalizedStrings" /> class. /// </summary> - public LocalizedStrings() + public LocalizedStrings(IServerApplicationPaths appPaths) { + _appPaths = appPaths; + foreach (var stringObject in Kernel.Instance.StringFiles) { AddStringData(LoadFromFile(GetFileName(stringObject),stringObject.GetType())); @@ -55,7 +58,7 @@ namespace MediaBrowser.Controller.Localization /// <returns>System.String.</returns> protected string GetFileName(LocalizedStringData stringObject) { - var path = Kernel.Instance.ApplicationPaths.LocalizationPath; + var path = _appPaths.LocalizationPath; var name = Path.Combine(path, stringObject.Prefix + "strings-" + CultureInfo.CurrentCulture + ".xml"); if (File.Exists(name)) { @@ -125,17 +128,17 @@ namespace MediaBrowser.Controller.Localization } catch (TargetException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } catch (FieldAccessException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } catch (NotSupportedException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } |
