Missing Resource Strings and how to use them in input field?

Kayla Johnson asked on October 24, 2017 17:05

https://docs.kentico.com/k10/multilingual-websites/setting-up-a-multilingual-user-interface/working-with-resource-strings

This guide doesn't explain how to use Resource Strings in a Layout. I need to modify the login form to use a String in the WatermarkText field. Simply saying "<cms:CMSTextBox ID="UserName" runat="server" MaxLength="100" WatermarkText="LogonForm.Email" />" does not work.

Also when I go to view the site's Resource Strings there are only 2 - one of which I just created. How can I change all the LogonForm Resource strings?

https://pasteboard.co/GQqyhFB.png

Correct Answer

Brenden Kehren answered on October 24, 2017 21:22

In v10 C# code you typically use something like this:

CMS.Helpers.ResHelper.GetString("LogonForm.Email")

Check out the documentation for resource strings, specifically this:

Resource string priority

When loading resource strings, the system uses the following priority:

  1. database (Localization application) – highest priority
  2. site specific resx files
  3. resx files of custom modules
  4. custom.resx
  5. cms.resx

If there are duplicate strings with the same key in all five sources, the system uses the one stored in the database.

So what this means is if there is a key of LogonForm.Email in the /CMSResoruces/CMS.resx file, you can simply add that same key in the Localization app with a different value and the system, by default, will return what is in the Localization app (database).

3 votesVote for this answer Unmark Correct answer

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