Localization RESX Files

Feb 10, 2011 at 6:57 PM
Edited Feb 10, 2011 at 6:59 PM

Where I can find sample code for:
 

mdo:resx(resx-file-base-name, string-key)
Searches resx file for localized value for the string. 

 

For example If I have this code:

<mdo:setup>
    <section label-width="200px" > News Settings </section>
    <setting name="date" type="date">
        <caption>Begin date</caption>
        <tooltip>Service will be provided on and after this date.</tooltip>
        <validator type="range" min="01/01/2000" max="01/01/2020" data-type="Date">
            This must be a valid date.
        </validator>
    </setting>
</mdo:setup>


How I can replace "Begin Date" with text values from:

UIValues.resx
UIValues.ru-RU.resx 

Coordinator
Feb 10, 2011 at 8:15 PM

Unfortunately I have no sample for resx at the moment... You can achive what you need as follows:

<mdo:setup>
  <xsl:variable name="resx" select=" '<path>/UIValues' "/>
    <section label-width="200px" > News Settings </section>
    <setting name="date" type="date">
        <caption>{{mdo:resx($resx, 'key')}}</caption>
        <tooltip>Service will be provided on and after this date.</tooltip>
        <validator type="range" min="01/01/2000" max="01/01/2020" data-type="Date">
            This must be a valid date.
        </validator>
    </setting>
</mdo:setup>

  • <path> - relative virtual path to resx file. e.g. ~/MyResources
  • key - value in "Name" column in resource editor grid.
Feb 11, 2011 at 7:11 AM

Works great!
Thanks! 

Feb 11, 2011 at 7:43 AM

It Work Fine in Setup part but how I can use this in telerix table Header Text?
If I write this:

<mdo:asp xmlns:asp="asp" xmlns:telerik="telerik">
  <xsl:variable name="resx" select=" '~/DesktopModules/NajdiNET/App_LocalResources/Global' "/>
      <asp:SqlDataSource
          id="dsPeople"
          runat="server"
          EnableCaching="False"
          ConnectionString="&lt;%$ ConnectionStrings:SiteSqlServer %&gt;"
          SelectCommand="SELECT ID, FirstName, LastName, RDatum FROM People"
          InsertCommand="INSERT People(FirstName, LastName, RDatum) VALUES(@FirstName, @LastName, @RDatum)"
          UpdateCommand="UPDATE People SET FirstName = @FirstName, LastName = @LastName, RDatum = @RDatum WHERE ID = @ID"
          DeleteCommand="DELETE People WHERE ID = @ID"
       />
      <telerik:RadGrid
          DataSourceID="dsPeople"
          DataKeyNames="ID"

          AllowPaging="True"
          PageSize="10"

          AutoGenerateColumns="False"

          AllowAutomaticDeletes="True"
          AllowAutomaticInserts="True"
          AllowAutomaticUpdates="True"

          Skin="Office2007"
          runat="server">

        <MasterTableView EditMode="InPlace" CommandItemDisplay="Bottom"
                         DataSourceID="dsPeople" DataKeyNames="ID">
         <Columns>
         
           <telerik:GridEditCommandColumn
             ButtonType="ImageButton"
             UniqueName="EditCommandColumn">
		<ItemStyle Width="40px" />
		</telerik:GridEditCommandColumn>

           <telerik:GridBoundColumn
              DataType="System.String"
              DataField="FirstName"
              HeaderText="{{mdo:resx($resx, 'TT_FirstName.Text')}}"
              UniqueName="FirstName" />
              
           <telerik:GridBoundColumn
              Visible="False"
              DataType="System.Int32"
              DataField="ID"
              HeaderText="ID"
              UniqueName="ID" />

           <telerik:GridBoundColumn
              DataField="LastName"
              DataType="System.String"
              HeaderText="Last Name"
              UniqueName="LastName" />

	<telerik:GridDateTimeColumn
		UniqueName="RDatum"
		PickerType="DateTimePicker"
		HeaderText="DateTime Column"
		DataField="RDatum"
		FooterText="DateTimeColumn footer"
		DataFormatString="{{0:dd/MM/yyyy HH:mm:ss}}"
		EditDataFormatString="dd/MM/yyyy HH:mm:ss">
		<ItemStyle Width="150px" />
		</telerik:GridDateTimeColumn>
		
           <telerik:GridButtonColumn
              ConfirmText="Delete this person?" ConfirmDialogType="RadWindow"
              ConfirmTitle="Delete" ButtonType="ImageButton"
              CommandName="Delete" Text="Delete"
              UniqueName="DeleteColumn">
		<ItemStyle Width="20px" />
		</telerik:GridButtonColumn>

         </Columns>
        </MasterTableView>
      </telerik:RadGrid>
</mdo:asp>

With this I get this :     {mdo:resx($resx, 'TT_FirstName.Text')}        in table header and not value.
What is wrong with this code?

Feb 11, 2011 at 7:47 AM

Find problem.

I was using {{mdo:resx($resx, 'TT_FirstName.Text')}}

If I use {mdo:resx($resx, 'TT_FirstName.Text')} work fine

{{ -> {    !!!

Coordinator
Feb 11, 2011 at 10:35 AM

In pure XSL curly brackets define transformation template inside attribute. And, if you are using double brackets XSL renders single ones. So you have to write

  HeaderText="{mdo:resx($resx, 'TT_FirstName.Text')}"

When double brackets {{...}} are used inside tag body (not in attribute) XsltDb expands them into value-of expression as described here:

http://xsltdb.codeplex.com/wikipage?title=xsl:value-of%20replacer