List of XForm System Localization Keys in EPiServer 7

on April 30, 2013 in Episerver, Episerver 7, Localization, XForms

I've recently been working on translating text that is displayed along with an XForm property. Since the localizations that are shipped with EPiServer 7 are now embedded in the assemblies, it's not as easy as searching through an XML file for the keys you need to override. So, as a reference, here are the system localization keys related to XForms that are embedded into EPiServer 7.

These are keys and values:

/xform/datatypes/date1/caption: Date (DD/MM/YYYY) 
/xform/datatypes/date1/inlineerrormessage: Not a valid date. Please enter a date in the format "DD/MM/YYYY". 
/xform/datatypes/date1/summaryerrormessage: * is not a valid date. Please enter a date in the format "DD/MM/YYYY". 
/xform/datatypes/date2/caption: Date (MM/DD/YYYY) 
/xform/datatypes/date2/inlineerrormessage: Not a valid date. Please enter a date in the format "MM/DD/YYYY". 
/xform/datatypes/date2/summaryerrormessage: * is not a valid date. Please enter a date in the format "MM/DD/YYYY". 
/xform/datatypes/defaulttype/inlineerrormessage: You have entered characters that are not permitted ("<" or ">"). 
/xform/datatypes/defaulttype/summaryerrormessage: You have entered characters that are not permitted ("<" or ">"). 
/xform/datatypes/email/caption: E-mail address 
/xform/datatypes/email/inlineerrormessage: Not a valid e-mail address. 
/xform/datatypes/email/summaryerrormessage: * is not a valid e-mail address. 
/xform/datatypes/integer/caption: Integer 
/xform/datatypes/integer/inlineerrormessage: Not a valid integer. 
/xform/datatypes/integer/summaryerrormessage: * is not a valid integer. 
/xform/datatypes/isodate/caption: Date (YYYY-MM-DD) 
/xform/datatypes/isodate/inlineerrormessage: Not a valid date. Please enter a date in the format "YYYY-MM-DD". 
/xform/datatypes/isodate/summaryerrormessage: * is not a valid date. Please enter a date in the format "YYYY-MM-DD". 
/xform/datatypes/positiveinteger/caption: Positive integer 
/xform/datatypes/positiveinteger/inlineerrormessage: Not a valid positive integer. 
/xform/datatypes/positiveinteger/summaryerrormessage: * is not a valid positive integer. 
/xform/denymultipleposts: You have already filled in this form 
/xform/errorpostingtocustomurl: The form could not be sent to a custom address 
/xform/errorpostingtodatabase: The form could not be sent to the database 
/xform/errorpostingtoemail: The form could not be sent to an e-mail address 
/xform/requiredfield/inlineerrormessage: This field is required 
/xform/requiredfield/summaryerrormessage: You haven't specified all required fields 
/xform/requiredfield/summaryerrormessageformat: You have not specified the required field "{0}". 
/xform/requirelogon: You must be logged in to answer

As you can see, the keys are primarily used to supply the error messages for the validations, and are unrelated to the localization of any other elements in the XForm.

As I mentioned in a previous post, the old 'lang' folder has disappeared with the release of EPiServer 7, and the documentation explained why:

If you want to override the system localizations that are shipped with EPiServer products, you will notice that the language files are no longer installed in the lang folder. They are now instead embedded in the assemblies but just as before you can override individual string by placing your own language XML in the lang folder. Of course you can include your localizations through any other LocalizationProvider and they will take precedence over the system localizations as long as the provider is registered before the system ones.

These translations live in the 'en' language branch, which is EPiServer's default language branch. With the proper localization fallback behavior configured, you'll see these translations for any language branch. If you want to customize the translations for the 'en' language branch, or for a completely different language branch, you would just need add them to your own language XML file and specify the language, which would look something like this:

<?xml version="1.0" encoding="utf-8" ?>
<languages>
  <language name="English (United States)" id="en-US">
    <xform>
	  <requirelogon>Custom logged in alert</requirelogon>
	  <datatypes>
	    <email>
		  <inlineerrormessage>Custom email error</inlineerrormessage>
		</email>
	  </datatypes>
	</xform>
  </language>
</languages>

If you're curious about the code I used to get the list, it's actually pretty simple. You could easily customize this code to retrieve any other system localization areas that you need to override:

var resources = LocalizationService.Current.GetAllStrings().Where(t => t.Key.StartsWith("/xform")).ToList();