U4-4761 Member translation

Makes all trees translateable, does not break the current titles set on
atttributes, but for trees that does not have a title set, the tree wil
try to look up a treeheader.
This commit is contained in:
Per Ploug
2015-09-24 15:30:08 +02:00
parent 60041a2893
commit 6dc4e2d2ae
3 changed files with 22 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ namespace Umbraco.Web.Trees
Constants.Applications.Media,
Constants.Applications.Members)]
[LegacyBaseTree(typeof (loadMembers))]
[Tree(Constants.Applications.Members, Constants.Trees.Members, "Members")]
[Tree(Constants.Applications.Members, Constants.Trees.Members)]
[PluginController("UmbracoTrees")]
[CoreTree]
public class MemberTreeController : TreeController

View File

@@ -20,7 +20,7 @@ namespace Umbraco.Web.Trees
/// <param name="sortOrder">The sort order.</param>
public TreeAttribute(string appAlias,
string alias,
string title,
string title = "",
string iconClosed = "icon-folder",
string iconOpen = "icon-folder-open",
bool initialize = true,

View File

@@ -1,8 +1,12 @@
using System;
using System.Collections.Concurrent;
using System.Globalization;
using System.Linq;
using System.Net.Http.Formatting;
using System.Threading;
using System.Web.Security;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
@@ -37,7 +41,22 @@ namespace Umbraco.Web.Trees
/// </summary>
public override string RootNodeDisplayName
{
get { return _attribute.Title; }
get
{
//if title is defined, return that
if(string.IsNullOrEmpty(_attribute.Title) == false)
return _attribute.Title;
//try to look up a tree header matching the tree alias
var culture = CultureInfo.GetCultureInfo(Security.CurrentUser.Language.Replace("_", "-"));
var localizedLabel = Services.TextService.Localize("treeHeaders/" + _attribute.Alias, culture);
if (string.IsNullOrEmpty(localizedLabel) == false)
return localizedLabel;
//is returned to signal that a label was not found
return "[" + _attribute.Alias + "]";
}
}
/// <summary>