Anyone who’s spent any time configuring RCDCs knows it’s a time consuming and often frustrating process. I’m sure I’m not the only one who’s sat there progressively uncommenting blocks of XML, trying to track down that one little error that’s screwed up the whole form.
Certainly I don’t want my customer to have to go through this every time someone complains that it should be “Family Name” instead of “Surname’, or whatever the flavour of the month happens to be. Sure you can set it up so that each field title and description comes from the schema, but you can also go a step further with String Resources.
You don’t have to look at an RCDC very long to notice a lot of variables that look like this: %SYMBOL_AFCaption_END%.
But where are they defined? The answer is the String Resources field which you can get at through the Localization tab of the RCDC configuration. The String Resources are actually there to allow you to customise the Portal for different languages. But even in a single-language environment it can be good to use them.
Like the RCDC configuration itself you can export the String Resources as an XML file, edit them, and load them back in. Just use the file control underneath the String Resources field. You will need to recycle the Sharepoint:80 app pool after uploading if you want to see an immediate effect.
And the great thing is that you can replace every bit of hard-coded text in the RCDC with a String Resource.
The text on the tab captions can be controlled by a string resource, as is already the case for the default RCDC tabs:
<my:Grouping my:Name="Identification" my:Caption="%SYMBOL_IdentificationCaption_END%" my:Enabled="true" my:Visible="true">
Something that I’ve just gone through and done in the RCDCs on my current project is to add a Hint parameter to every single control:
<my:Control my:Name="PreferredFirstName" my:TypeName="UocTextBox" my:Caption="{Binding Source=schema, Path=PreferredFirstName.DisplayName}" my:Description="{Binding Source=schema, Path=PreferredFirstName.Description}" my:RightsLevel="{Binding Source=rights, Path=PreferredFirstName}" my:Hint="%SYMBOL_PreferredFirstNameHint_END%" > <my:Properties> <my:Property my:Name="Required" my:Value="{Binding Source=schema, Path=PreferredFirstName.Required}"/> <my:Property my:Name="Columns" my:Value="34"/> <my:Property my:Name="MaxLength" my:Value="128"/> <my:Property my:Name="Text" my:Value="{Binding Source=object, Path=PreferredFirstName, Mode=TwoWay}"/> </my:Properties> </my:Control>
Most of them are just set to empty strings in the String Resources setting, but the customer should now find it far more straight-forward to set a hint if one is needed:
<SymbolResourcePair Symbol="PreferredFirstNameHint" ResourceString=""/>
Here’s another example: using String Resources so set the search box text in a UocIdentityPicker:
<my:Control my:Name="Manager" my:TypeName="UocIdentityPicker" my:Caption="{Binding Source=schema, Path=Manager.DisplayName}" my:Description="{Binding Source=schema, Path=Manager.Description}" my:RightsLevel="{Binding Source=rights, Path=Manager}" my:Hint="%SYMBOL_ManagerHint_END%"> <my:Properties> <my:Property my:Name="Required" my:Value="true"/> <my:Property my:Name="Mode" my:Value="SingleResult"/> <my:Property my:Name="ObjectTypes" my:Value="Person"/> <my:Property my:Name="UsageKeywords" my:Value="ActiveAD"/> <my:Property my:Name="ColumnsToDisplay" my:Value="DisplayName, Department"/> <my:Property my:Name="AttributesToSearch" my:Value="FirstName, LastName, PreferredFirstName, AccountName"/> <my:Property my:Name="Value" my:Value="{Binding Source=object, Path=Manager, Mode=TwoWay}"/> <my:Property my:Name="ListViewTitle" my:Value="%SYMBOL_ManagerListViewTitle_END%"/> <my:Property my:Name="PreviewTitle" my:Value="%SYMBOL_ManagerPreviewTitle_END%"/> <my:Property my:Name="MainSearchScreenText" my:Value="%SYMBOL_ManagerSearchText_END%"/> </my:Properties> </my:Control>
And the variables defined in String Resources:
<SymbolResourcePair Symbol="ManagerHint" ResourceString=""/> <SymbolResourcePair Symbol="ManagerListViewTitle" ResourceString="All People"/> <SymbolResourcePair Symbol="ManagerPreviewTitle" ResourceString="Selected Person"/> <SymbolResourcePair Symbol="ManagerSearchText" ResourceString="Search People"/>
You can also use them to replace the Text on check boxes, and the Captions on radio control options… Basicaly anywhere you find yourself hard-coding text in an RCDC have a think: would a String Resource work better here?
And one final plus point – if you mess up the XML in String Resources by forgetting a quote or something it doesn’t break your whole form -Â you just get some missing text and a note in red at the bottom of the form about which variables are missing. Both less risky and easier to troubleshoot than editing the RCDC configuration XML!