Reports - update localization

This commit is contained in:
Tavares André 2015-07-28 13:32:08 +02:00
parent ba2574a03b
commit 162d6dd917
6 changed files with 86 additions and 24 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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())

View File

@ -125,5 +125,55 @@
"HeaderImagePrimary": "Primary",
"HeaderImageBackdrop": "Backdrop",
"HeaderImageLogo": "Logo",
"HeaderUserPrimaryImage": "User Image"
"HeaderUserPrimaryImage": "User Image",
"HeaderOverview": "Overview",
"HeaderShortOverview": "Short Overview",
"HeaderType": "Type",
"HeaderSeverity": "Severity",
"HeaderUser": "User",
"HeaderName": "Name",
"HeaderDate": "Date",
"HeaderPremiereDate": "Premiere Date",
"HeaderDateAdded": "Date Added",
"HeaderReleaseDate": "Release date",
"HeaderRuntime": "Runtime",
"HeaderPlayCount": "Play Count",
"HeaderSeason": "Season",
"HeaderSeasonNumber": "Season number",
"HeaderSeries": "Series:",
"HeaderNetwork": "Network",
"HeaderYear": "Year:",
"HeaderYears": "Years:",
"HeaderParentalRating": "Parental Rating",
"HeaderCommunityRating": "Community rating",
"HeaderTrailers": "Trailers",
"HeaderSpecials": "Specials",
"HeaderGameSystems": "Game Systems",
"HeaderPlayers": "Players:",
"HeaderAlbumArtists": "Album Artists",
"HeaderAlbums": "Albums",
"HeaderDisc": "Disc",
"HeaderTrack": "Track",
"HeaderAudio": "Audio",
"HeaderVideo": "Video",
"HeaderEmbeddedImage": "Embedded image",
"HeaderResolution": "Resolution",
"HeaderSubtitles": "Subtitles",
"HeaderGenres": "Genres",
"HeaderCountries": "Countries",
"HeaderStatus": "Status",
"HeaderTracks": "Tracks",
"HeaderMusicArtist": "Music artist",
"HeaderLocked": "Locked",
"HeaderStudios": "Studios",
"HeaderActor": "Actors",
"HeaderComposer": "Composers",
"HeaderDirector": "Directors",
"HeaderGuestStar": "Guest star",
"HeaderProducer": "Producers",
"HeaderWriter": "Writers",
"HeaderParentalRatings": "Parental Ratings",
"HeaderCommunityRatings": "Community ratings",
}