From 07c714fd11d7eb37f97fec3e24ccf44617329a11 Mon Sep 17 00:00:00 2001 From: engern Date: Sat, 21 Nov 2015 11:33:46 +0100 Subject: [PATCH] Fixes U4-7424 Add the possibilty to change the error message when a macro partial view fails to render. --- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 1 + src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml | 1 + src/Umbraco.Web/umbraco.presentation/macro.cs | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 582bb077ef..7ffa57eaec 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -301,6 +301,7 @@ NOTE! Even though CodeMirror is enabled by configuration, it is disabled in Internet Explorer because it's not stable enough. Please fill both alias and name on the new property type! There is a problem with read/write access to a specific file or folder + Error loading Partial View script (file: %0%) Please enter a title Please choose a type You're about to make the picture larger than the original size. Are you sure that you want to proceed? diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index c9dcd1554a..b5a686eec1 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -302,6 +302,7 @@ NOTE! Even though CodeMirror is enabled by configuration, it is disabled in Internet Explorer because it's not stable enough. Please fill both alias and name on the new property type! There is a problem with read/write access to a specific file or folder + Error loading Partial View script (file: %0%) Please enter a title Please choose a type You're about to make the picture larger than the original size. Are you sure that you want to proceed? diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index 53bdaaa9de..4797709fde 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -24,6 +24,7 @@ using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Macros; using Umbraco.Core.Models; +using Umbraco.Core.Services; using Umbraco.Core.Xml.XPath; using Umbraco.Core.Profiling; using umbraco.interfaces; @@ -322,7 +323,13 @@ namespace umbraco Exception = e, Behaviour = UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour }; - return GetControlForErrorBehavior("Error loading Partial View script (file: " + ScriptFile + ")", macroErrorEventArgs); + + var errorMessage = ApplicationContext.Current.Services.TextService.Localize("errors/macroErrorLoadingPartialView",new[]{ScriptFile}); + if (errorMessage.Equals("[macroErrorLoadingPartialView]")) // This check can be removed when key is added to every language file + { + errorMessage = "Error loading Partial View script (file: " + ScriptFile + ")"; + } + return GetControlForErrorBehavior(errorMessage, macroErrorEventArgs); }; using (DisposableTimer.DebugDuration("Executing Partial View: " + Model.TypeName))