how to use localization in ASCX transformation?

Alexey Sidelnikov asked on March 7, 2014 19:42

what's the right way to use localization macros in ASCX transformation? So far I was able to get to this:

<%# 
      CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros(
             (bool)Eval("isUserActive") == true ? "{$boolean_yes$}" : "{$boolean_no$}" 
       ) 
%>

but it looks... ugly?.. am I doing everything right? Basically I have a boolean field and I want to display yes/no in user's language.

Correct Answer

Juraj Ondrus answered on March 8, 2014 08:28

Hi,

Since macros are not supported in ASCX transformation, this is the correct way.

Best regards,
Juraj Ondrus

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on March 21, 2014 09:04

I believe you could also use this <%# (EvalBoolean("isUserActive") ? CMS.GlobalHelper.ResHelper.LocalizeString("{$boolean_yes$}) : CMS.GlobalHelper.ResHelper.LocalizeString("{$boolean_no$})) %> vs. a macro.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.