Search code examples
c#dotnetnuke

How do I add a conditional statement to a resx file?


I have a child portal in DNN installation whose site name I do not want to appear in an email compiled by a resx file. I want to use the main site's name instead. Example, xyz.com will send an email with the site name of "XZY" but the child portal xzy.com/abc would send an email with the site name of "ABC". I want to replace "ABC" with "XZY". Keep in mind that I have more than one child portal. How do I write a conditional statement in the resx file to check [Portal:PortalName] and replace with "ABC" if yes?

<data name="EMAIL_PORTAL_SIGNUP_SUBJECT.Text" xml:space="preserve">
   <value>[Portal:PortalName] Portal Signup</value>
</data>

Add a condition like so:

<value>If[Portal:PortalName]="ABC", "XYZ" Else [Portal:PortalName]</value>

EDIT: I forgot to add one more thing. The resx file is globalresources.resx used for all portals in the DNN installation. This file manages email templates (such as forgot password, notification, etc) and HTML pages (such as Terms of Use and Privacy Statement). This file is located in httpdocs/App_GlobalResources folder. THis is used by the main portal and all child portals.


Solution

  • You can edit a resx file by going to "Admin > Languages"

    There you can click on "Site". That will open the familiar popup with a Treeview.

    Find the correct resx file by expanding the treeview, edit and save. DNN will add the portal id to the resx filename: Terms.ascx.Portal-0.resx, so it probably also work by editing and saving like that manually (not tested)

    enter image description here