diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-07-28 08:35:57 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-07-28 08:35:57 -0400 |
| commit | af4cb1de35c64d42f96694295b535e81384ac2fa (patch) | |
| tree | 1ec5abdeb29e8a20bb68b0a8351d1ce3c1d88493 /MediaBrowser.Api | |
| parent | ba2574a03b76f98b3688755f2afaad4ee01333d0 (diff) | |
| parent | 162d6dd917e6d6e966a83e65c4ec1d340e602540 (diff) | |
Merge pull request #1149 from t-andre/dev
Reports - update localization
Diffstat (limited to 'MediaBrowser.Api')
5 files changed, 35 insertions, 23 deletions
diff --git a/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs b/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs index 33d36f11b6..83816c6e3b 100644 --- a/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs +++ b/MediaBrowser.Api/Reports/Activities/ReportActivitiesBuilder.cs @@ -130,6 +130,7 @@ namespace MediaBrowser.Api.Reports { case HeaderMetadata.Name: option.Column = (i, r) => i.Name; + option.Header.SortField = ""; break; case HeaderMetadata.Overview: option.Column = (i, r) => i.Overview; diff --git a/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs b/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs index 74fcdd1495..af5abf46aa 100644 --- a/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs +++ b/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs @@ -47,6 +47,17 @@ namespace MediaBrowser.Api.Reports ImagePrimary, ImageBackdrop, ImageLogo, + Actor, + Studios, + Composer, + Director, + GuestStar, + Producer, + Writer, + Artist, + Years, + ParentalRatings, + CommunityRatings, //Activity logs Overview, diff --git a/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs b/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs index 81b441a071..6e1dd8d35f 100644 --- a/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs +++ b/MediaBrowser.Api/Reports/Common/ReportBuilderBase.cs @@ -155,9 +155,7 @@ namespace MediaBrowser.Api.Reports if (internalHeader != HeaderMetadata.None) { string localHeader = "Header" + internalHeader.ToString(); - headerName = internalHeader != HeaderMetadata.None ? ReportHelper.GetJavaScriptLocalizedString(localHeader) : ""; - if (string.Compare(localHeader, headerName, StringComparison.CurrentCultureIgnoreCase) == 0) - headerName = ReportHelper.GetServerLocalizedString(localHeader); + headerName = ReportHelper.GetCoreLocalizedString(localHeader); } return headerName; } diff --git a/MediaBrowser.Api/Reports/Common/ReportHelper.cs b/MediaBrowser.Api/Reports/Common/ReportHelper.cs index c70cedf615..9dc4fbd51e 100644 --- a/MediaBrowser.Api/Reports/Common/ReportHelper.cs +++ b/MediaBrowser.Api/Reports/Common/ReportHelper.cs @@ -76,14 +76,6 @@ namespace MediaBrowser.Api.Reports return rType; } - /// <summary> Gets java script localized string. </summary> - /// <param name="phrase"> The phrase. </param> - /// <returns> The java script localized string. </returns> - public static string GetJavaScriptLocalizedString(string phrase) - { - return BaseItem.LocalizationManager.GetLocalizedString(phrase); - } - /// <summary> Gets report view type. </summary> /// <param name="rowType"> The type. </param> /// <returns> The report view type. </returns> @@ -132,10 +124,10 @@ namespace MediaBrowser.Api.Reports return rType; } - /// <summary> Gets server localized string. </summary> + /// <summary> Gets core localized string. </summary> /// <param name="phrase"> The phrase. </param> - /// <returns> The server localized string. </returns> - public static string GetServerLocalizedString(string phrase) + /// <returns> The core localized string. </returns> + public static string GetCoreLocalizedString(string phrase) { return BaseItem.LocalizationManager.GetLocalizedString(phrase); } diff --git a/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs b/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs index 8cb57c030f..c9ee6337ff 100644 --- a/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs +++ b/MediaBrowser.Api/Reports/Stat/ReportStatBuilder.cs @@ -110,7 +110,7 @@ namespace MediaBrowser.Api.Reports /// <returns> The resul production locations. </returns> private ReportStatResult GetResulProductionLocations(ReportStatResult result, BaseItem[] items, int topItem = 5) { - this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderCountries"), topItem, + this.GetGroups(result, GetLocalizedHeader(HeaderMetadata.Countries), topItem, items.OfType<IHasProductionLocations>() .Where(x => x.ProductionLocations != null) .SelectMany(x => x.ProductionLocations) @@ -134,7 +134,7 @@ namespace MediaBrowser.Api.Reports /// <returns> The result community ratings. </returns> private ReportStatResult GetResultCommunityRatings(ReportStatResult result, BaseItem[] items, int topItem = 5) { - this.GetGroups(result, ReportHelper.GetServerLocalizedString("LabelCommunityRating"), topItem, + this.GetGroups(result, GetLocalizedHeader(HeaderMetadata.CommunityRating), topItem, items.Where(x => x.CommunityRating != null && x.CommunityRating > 0) .GroupBy(x => x.CommunityRating) .OrderByDescending(x => x.Count()) @@ -156,7 +156,7 @@ namespace MediaBrowser.Api.Reports /// <returns> The result genres. </returns> private ReportStatResult GetResultGenres(ReportStatResult result, BaseItem[] items, int topItem = 5) { - this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderGenres"), topItem, + this.GetGroups(result, GetLocalizedHeader(HeaderMetadata.Genres), topItem, items.SelectMany(x => x.Genres) .GroupBy(x => x) .OrderByDescending(x => x.Count()) @@ -178,7 +178,7 @@ namespace MediaBrowser.Api.Reports /// <returns> The result parental ratings. </returns> private ReportStatResult GetResultParentalRatings(ReportStatResult result, BaseItem[] items, int topItem = 5) { - this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderParentalRatings"), topItem, + this.GetGroups(result, GetLocalizedHeader(HeaderMetadata.ParentalRatings), topItem, items.Where(x => x.OfficialRating != null) .GroupBy(x => x.OfficialRating) .OrderByDescending(x => x.Count()) @@ -200,16 +200,26 @@ namespace MediaBrowser.Api.Reports /// <returns> The result persons. </returns> private ReportStatResult GetResultPersons(ReportStatResult result, BaseItem[] items, int topItem = 5) { - List<string> t = new List<string> { PersonType.Actor, PersonType.Composer, PersonType.Director, PersonType.GuestStar, PersonType.Producer, PersonType.Writer, "Artist", "AlbumArtist" }; + List<HeaderMetadata> t = new List<HeaderMetadata> + { + HeaderMetadata.Actor, + HeaderMetadata.Composer, + HeaderMetadata.Director, + HeaderMetadata.GuestStar, + HeaderMetadata.Producer, + HeaderMetadata.Writer, + HeaderMetadata.Artist, + HeaderMetadata.AlbumArtist + }; foreach (var item in t) { var ps = items.Where(x => x.People != null && x.SupportsPeople).SelectMany(x => x.People) - .Where(n => n.Type == item) + .Where(n => n.Type == item.ToString()) .GroupBy(x => x.Name) .OrderByDescending(x => x.Count()) .Take(topItem); if (ps != null && ps.Count() > 0) - this.GetGroups(result, ReportHelper.GetServerLocalizedString("Option" + item), topItem, + this.GetGroups(result, GetLocalizedHeader(item), topItem, ps.Select(x => new ReportStatItem { Name = x.Key, @@ -229,7 +239,7 @@ namespace MediaBrowser.Api.Reports /// <returns> The result production years. </returns> private ReportStatResult GetResultProductionYears(ReportStatResult result, BaseItem[] items, int topItem = 5) { - this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderYears"), topItem, + this.GetGroups(result, GetLocalizedHeader(HeaderMetadata.Year), topItem, items.Where(x => x.ProductionYear != null && x.ProductionYear > 0) .GroupBy(x => x.ProductionYear) .OrderByDescending(x => x.Count()) @@ -251,7 +261,7 @@ namespace MediaBrowser.Api.Reports /// <returns> The result studios. </returns> private ReportStatResult GetResultStudios(ReportStatResult result, BaseItem[] items, int topItem = 5) { - this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderStudios"), topItem, + this.GetGroups(result, GetLocalizedHeader(HeaderMetadata.Studios), topItem, items.SelectMany(x => x.Studios) .GroupBy(x => x) .OrderByDescending(x => x.Count()) |
