Also apply to media types - U4-541 Wrong dictionary key when using in backend template names
This commit is contained in:
@@ -404,6 +404,7 @@
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controllers\LoginController.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TranslateDictionaryItems.cs" />
|
||||
<Compile Include="UrlHelperExtensions.cs" />
|
||||
<Compile Include="UrlHelperRenderExtensions.cs" />
|
||||
<Compile Include="WebApi\MemberAuthorizeAttribute.cs" />
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Linq;
|
||||
using umbraco.cms.businesslogic.language;
|
||||
|
||||
namespace Umbraco.Web.umbraco.presentation.umbraco.Trees
|
||||
{
|
||||
internal class TranslateTreeNames
|
||||
{
|
||||
public static string GetTranslatedName(string originalName)
|
||||
{
|
||||
|
||||
if (originalName.StartsWith("#") == false)
|
||||
return originalName;
|
||||
|
||||
var lang = Language.GetByCultureCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
|
||||
|
||||
if (lang != null && global::umbraco.cms.businesslogic.Dictionary.DictionaryItem.hasKey(originalName.Substring(1, originalName.Length - 1)))
|
||||
{
|
||||
var dictionaryItem = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(originalName.Substring(1, originalName.Length - 1));
|
||||
if (dictionaryItem != null)
|
||||
return dictionaryItem.Value(lang.id);
|
||||
}
|
||||
|
||||
return "[" + originalName + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using umbraco.businesslogic;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.umbraco.presentation.umbraco.Trees;
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
@@ -50,7 +51,7 @@ function openMediaType(id) {
|
||||
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = mediaType.Id.ToString(CultureInfo.InvariantCulture);
|
||||
xNode.Text = mediaType.Name;
|
||||
xNode.Text = TranslateTreeNames.GetTranslatedName(mediaType.Name);
|
||||
xNode.Action = string.Format("javascript:openMediaType({0});", mediaType.Id);
|
||||
xNode.Icon = "settingDataType.gif";
|
||||
xNode.OpenIcon = "settingDataType.gif";
|
||||
|
||||
@@ -3,14 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.cms.businesslogic.language;
|
||||
using Umbraco.Core.Services;
|
||||
using umbraco.businesslogic;
|
||||
using umbraco.interfaces;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.umbraco.presentation.umbraco.Trees;
|
||||
|
||||
|
||||
namespace umbraco
|
||||
@@ -69,7 +68,7 @@ function openNodeType(id) {
|
||||
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = docType.Id.ToString(CultureInfo.InvariantCulture);
|
||||
xNode.Text = GetTranslatedNodeTypeName(docType.Name);
|
||||
xNode.Text = TranslateTreeNames.GetTranslatedName(docType.Name);
|
||||
xNode.Action = "javascript:openNodeType(" + docType.Id + ");";
|
||||
xNode.Icon = "settingDataType.gif";
|
||||
xNode.OpenIcon = "settingDataType.gif";
|
||||
@@ -94,23 +93,5 @@ function openNodeType(id) {
|
||||
{
|
||||
get { return Services.ContentTypeService; }
|
||||
}
|
||||
|
||||
private string GetTranslatedNodeTypeName(string originalName)
|
||||
{
|
||||
|
||||
if (originalName.StartsWith("#") == false)
|
||||
return originalName;
|
||||
|
||||
var lang = Language.GetByCultureCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
|
||||
|
||||
if (lang != null && Dictionary.DictionaryItem.hasKey(originalName.Substring(1, originalName.Length - 1)))
|
||||
{
|
||||
var dictionaryItem = new Dictionary.DictionaryItem(originalName.Substring(1, originalName.Length - 1));
|
||||
if (dictionaryItem != null)
|
||||
return dictionaryItem.Value(lang.id);
|
||||
}
|
||||
|
||||
return "[" + originalName + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user