admin管理员组

文章数量:1406177

I'm trying to put a macro in a resource string from the localization module but I'm having problems resolving it.

I also resigned all macros and also tried replacing the hash with an '@' symbol so it wouldn't be checked

var bodyText = MacroResolver.Resolve(ResHelper.GetString("SOS.SocialSharing.Email.Body"));
var test = ResHelper.LocalizeString("{$SOS.SocialSharing.Email.Body$}");
var test2 = MacroResolver.Resolve("{$SOS.SocialSharing.Email.Body$}");

All methods return the same thing:

Hello,
please share this link {% DocumentContext.CurrentDocument.AbsoluteURL |(user)admin|(hash)myhash%} with your friends

My resource string looks like this (the hash gets inserted by kentico)

I'm trying to put a macro in a resource string from the localization module but I'm having problems resolving it.

I also resigned all macros and also tried replacing the hash with an '@' symbol so it wouldn't be checked

var bodyText = MacroResolver.Resolve(ResHelper.GetString("SOS.SocialSharing.Email.Body"));
var test = ResHelper.LocalizeString("{$SOS.SocialSharing.Email.Body$}");
var test2 = MacroResolver.Resolve("{$SOS.SocialSharing.Email.Body$}");

All methods return the same thing:

Hello,
please share this link {% DocumentContext.CurrentDocument.AbsoluteURL |(user)admin|(hash)myhash%} with your friends

My resource string looks like this (the hash gets inserted by kentico)

Share Improve this question asked Mar 6 at 13:26 roryrory 1,4384 gold badges26 silver badges52 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Where exactly are you trying to resolve the macro? Is it inside the admin UI or on the live site? If it is on the live site and you are using .NET Core, then you should be following this approach

Otherwise, since Kentico 10 for security reasons, macros are not evaluated/resolved recursively. You can try using the "recursive" macro parameter. If true, the system resolves macro expressions contained in the macro’s result recursively.

本文标签: Kentico 13 How to resolve a macro in a resource stringStack Overflow