Resources, GlobalResources, SharedResources and more in the Language Editor
You may not use or have any interest in DNN sites using multiple languages, but the Languages editor is still very useful for a variety of site customizations.
Most people approach their needs with a specific question and having all this power under Site Settings / Languages can make it difficult to figure out where to go when the question in your head is:
How do I edit the registration emails DNN sends?
Can I change the word "Site" to "Intranet" in a bunch of places in the PersonaBar?
Is it possible to customize my site's Terms and Conditions?
Note: If you don't mind missing a few pretty cool tips (below) and instead prefer a 3 minute video that demos making a change to DNN's Privacy text, I recommend you check our Will Strohl's 2018 video, "DNN: Using the Language Editor"
- Note that it shows DNN 9.x, so it's still current for the Persona Bar as of DNN v9.07.x.
So let's do the thing in steps, here is how to change one of the DNN 9+ core emails sent out to the site (portal) administrator when a user gets locked out for too many bad login attempts.
- Log in to your DNN instance as a super user
- In PersonaBar: Settings, Site Settings > Languages tab
- Click the last icon in the row of your language, to open Language Editor (screenclip)
- On the top right, you can switch from Global down to Site/Portal **
- From the Resource File dropdown list, expand Global Resources
- Then select GlobalResources; this will initially display 100s of values
- In the Search box (1) on the right, type "LOCKOUT"
- You should now see both the BODY (2) and SUBJECT of the email.
- Make your changes in the Localized Value (3) box (or click the Edit Pencil at right for a nice popup mini-WYSIWYG editor)
- When done, click the Save Translation button (4).
** in D (above), which you choose is beyond the scope (not a pun) of this article. But in general you just need to understand if you want the change you are making to be global to the DNN instance - meaning any/all portals - or just for one site (portal). For us and a lot of projects, the DNN instance just has 1 single portal and in that case it is convenient to just use Global.
That's it, but it's worth noting that after saving these resource files (*.resx) DNN (ASP.NET really) needs to do some recompiling and it may take your site 3 to 20 seconds or more to display the next page refresh or request.
The above PersonaBar UI works, and after a few repetitions, works well enough for an occasional one-off edit. But if your skill set makes you feel comfortable editing files in DNN "under-the-hood," read on for a more efficient approach.
I work at an agency and we host over 200 sites. In the last 2 years, we've migrated a lot of our DNN project work to GitHub Repositories (private) and use VS Code to do quite a bit of our DNN design and customization work. We call this Open Heart Surgery (OHS) and should probably give a call-out to 2sxc's Daniel Mettler for the terminology. :)
Before trying this, responsibility requires me to point out two very important things. 1) Always have backups (that you know you can restore by file, folder, or in full). 2) Using GitHub properly provides a wonderful level of history, revision details, and can make it fairly easy to confidently undo changes that have caused any type of unexpected results.
I'll have to leave getting VS Code setup to do OHS with a DNN site for another article. But the GIF below shows a fast and efficient way to edit, find, and update a value in resources. Click to zoom the GIF to full size in a new window/tab...
- In local files, edit (SFTP) config for the remote explorer to show the /App_GlobalResources folder (normally hidden in our projects)
- Switch to remote files, find the resx, Edit in Local
- Once open for editing, search for "smtp"
- Make your change, save/upload
In the above GIF, one of our standard project edits is the SMTP Configuration Test email. It's nice when it shows up, but if you didn't initiate the test-send, how do you know which site it came from? Who sent it? In my world, it can waste a lot of time when one of those emails shows up and you don't know who sent it on your team (or maybe the client?). So in App_GlobalResources/GlobalResources.resx (or *.Portal-[#].resx) we simply add the token for the Portal Name, very helpful:
And now you get an informative email:
You can see (and search) the full default version of DNN's GlobalResources.resx file in the GitHub repository, which is also a fast way to search for stuff and quickly find the details and keys you are looking for.
One more tip? Above in the GIF, did you catch a glimpse of the encoded HTML in the key/value below the one we were editing? When working in a text editor (like vscode) for email body values that are in HTML, don't forget to encode (e.g. "<p>" needs to be stored as "<p>"). You can markup your HTML in any editor (VS Code is used in the example) and then easily convert it using an online tool. There are many, just search for "html encode online" or rephrase as you like until you find one that works well for you.
Thanks: Will Strohl, Daniel Mettler, and Brittani Musgrove
Read more DNN Details posts... More about Accuraty...
And finally, a bonus shout out and thank you to the (unknown to me, but highly acclaimed) DNN developer who recently added the Host Email field - the email address the SMTP Configuration Test email (above) - to the PB/Settings, Server Settings tab, and SMTP Server sub-tab settings page!!
But what about DNN 8 and earlier?
If you are using DNN 8.x or earlier, two things. 1) upgrade, upgrade now, please upgrade, just do it. 2) this article recaps the past fairly well, Localizing the User Interface Content.