Localizing XForms in EPiServer File Manager
In the EPiServer fi开发者_如何学Cle upload dialogue, there is a section for adding meta data to an uploaded file such as Title, Link, Description, Author and Publisher. These form fields are implemented using XForms and configured in FileSummary.config.
The headings for these fields are defined directly in HTML markup containing the XForms controls as in the snippet below.
<tr>
<td class="EP-tableCaptionCell">
<span id="id_field1">Author</span>
</td>
<td valign="top" width="200" height="10">
<xforms:input ref="Author" value="" id="id_field2" size="40" class="commonInput" />
</td>
</tr>
My question is, how can I localise these field captions? In this case it would be Author.
The localisation is working in Japanese in every other section of the file manager driven from the lang xml file, but it seems this part of the file manager works in a totally different way from the rest of the episerver admin and edit.
EPiServer CMS feature XForm is used to render the form used in the upload dialog. You specify the file where the form is loaded from in a tag in web.config or episerver.config.
The file is processed and all xform-tags are replaced with EPiServer Web Controls for XForms. Then Page.ParseControl is used to transform the text into a User Control. This string cannot contain any code, because the ParseControl method never causes compilation but you can use other web controls.
There is only one small extra step. Since the text is converted to an xml document you need to add namespace either to the element itself or the root-tag.
<root ... xmlns:asp="dummy1" > ...
<td class="EP-tableCaptionCell">
<label for="id_field2" id="id_field1" style="margin-bottom: 10px;">
<asp:Label runat="server"
Text="TEST!"/>
<EPiServer:Translate xmlns:EPiServer="dummy2"
runat="server"
Text="/admin/admingroup/addgroup" />
</label>
</td>
精彩评论