[Springnet-commits] Spring.Net/doc/reference/src web.xml, 1.27, 1.28
Brought to you by:
aseovic,
markpollack
From: Erich E. <oak...@us...> - 2007-12-06 17:33:21
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv8398 Modified Files: web.xml Log Message: SPRNET-555, improved docs on configuring and using Localizers and Message Sources Index: web.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/web.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** web.xml 6 Dec 2007 08:53:35 -0000 1.27 --- web.xml 6 Dec 2007 17:33:17 -0000 1.28 *************** *** 1,3 **** ! <?xml version="1.0" encoding="UTF-8"?> <chapter id="web"> <title>Spring.NET Web Framework</title> --- 1,3 ---- ! <?xml version="1.0" encoding="UTF-8"?> <chapter id="web"> <title>Spring.NET Web Framework</title> *************** *** 1494,1498 **** <note> ! The Visual Studio Web Form Editor will of course complain about binding attributes because it doesn't know them. You can safely ignore those warnings. </note> </sect2> --- 1494,1498 ---- <note> ! The Visual Studio Web Form Editor will of course complain about binding attributes because it doesn't know them. You can safely ignore those warnings. </note> </sect2> *************** *** 1500,1504 **** <sect1 id="web-localization"> ! <title>Localization</title> <para>While recognizing that the .NET framework has excellent support for --- 1500,1504 ---- <sect1 id="web-localization"> ! <title>Localization and Message Sources</title> <para>While recognizing that the .NET framework has excellent support for *************** *** 1508,1512 **** <para>Every <literal>.aspx</literal> page in an ASP.NET project has a resource file associated with it, but those resources are never used (by ! the current ASP.NEt infrastructure). ASP.NET 2.0 will change that and allow application developers to use local resources for pages. In the meantime, the Spring.NET team built support for using local pages --- 1508,1512 ---- <para>Every <literal>.aspx</literal> page in an ASP.NET project has a resource file associated with it, but those resources are never used (by ! the current ASP.NET infrastructure). ASP.NET 2.0 will change that and allow application developers to use local resources for pages. In the meantime, the Spring.NET team built support for using local pages *************** *** 1568,1595 **** <td><asp:TextBox id="name" Runat="server" Width="150px"/></td> </tr> ! <tr> ! <td><asp:Label id="street1Label" Runat="server"/></td> ! <td><asp:TextBox id="street1" Runat="server" Width="150px"/></td> ! </tr> ! <tr> ! <td><asp:Label id="street2Label" Runat="server"/></td> ! <td><asp:TextBox id="street2" Runat="server" Width="150px"/></td> ! </tr> ! <tr> ! <td><asp:Label id="cityLabel" Runat="server"/></td> ! <td><asp:TextBox id="city" Runat="server" Width="150px"/></td> ! </tr> ! <tr> ! <td><asp:Label id="stateLabel" Runat="server"/></td> ! <td><asp:TextBox id="state" Runat="server" Width="30px"/></td> ! </tr> ! <tr> ! <td><asp:Label id="postalCodeLabel" Runat="server"/></td> ! <td><asp:TextBox id="postalCode" Runat="server" Width="60px"/></td> ! </tr> ! <tr> ! <td><asp:Label id="countryLabel" Runat="server"/></td> ! <td><asp:TextBox id="country" Runat="server" Width="150px"/></td> ! </tr> <tr> <td colspan="2"> --- 1568,1573 ---- <td><asp:TextBox id="name" Runat="server" Width="150px"/></td> </tr> ! ... ! <tr> <td colspan="2"> *************** *** 1629,1647 **** <value>Full name:</value> </data> ! <data name="$this.street1Label.Text"> ! <value>Street 1:</value> ! </data> ! <data name="$this.street2Label.Text"> ! <value>Street 2:</value> ! </data> ! <data name="$this.cityLabel.Text"> ! <value>City:</value> ! </data> ! <data name="$this.stateLabel.Text"> ! <value>State:</value> ! </data> ! <data name="$this.postalCodeLabel.Text"> ! <value>ZIP:</value> ! </data> <data name="$this.countryLabel.Text"> <value>Country:</value> --- 1607,1613 ---- <value>Full name:</value> </data> ! ! ... ! <data name="$this.countryLabel.Text"> <value>Country:</value> *************** *** 1655,1664 **** </root></programlisting> ! <para>The last two resource definitions require some additional ! explanation. In some cases it makes sense to apply a resource that is ! defined <emphasis>globally</emphasis> as opposed to locally. In this ! example, it makes better sense to define values for the ! <literal>Save</literal> and <literal>Cancel</literal> buttons globally ! as they will probably be used throughout the application.</para> <para>The above example demonstrates how one can achieve that by --- 1621,1674 ---- </root></programlisting> ! <tip> ! <title>VS2003</title> ! <para>To view the .resx file for a page, you may need to enable ! "Project/Show All Files" in Visual Studio.NET. When "Show All Files" ! is enabled, the .resx file appears like a "child" of the code-behind ! page.</para> ! ! <para>When Visual Studio.NET creates the .resx file, it will include a ! <literal>xds:schema</literal>element and several ! <literal>reshead</literal> elements. Your data elements will follow ! the <literal>reshead</literal> elements. When working with the .resx ! files, you may want to chose "Open With" from the context menu and ! select the "Source Code" text editor.</para> ! </tip> ! <tip> ! <title>VS2005</title> ! <para>To create a resource file in VS2005, open your control or page in ! design mode and select "Tools/Generate local resource" from the menu</para> ! </tip> ! ! <para>Finally a localizer must be configured for the page to enable automatic localization: ! </para> ! <programlisting><object id="localizer" type="Spring.Globalization.Localizers.ResourceSetLocalizer, Spring.Core"/> ! ! <object type="UserRegistration.aspx"> ! <property name="Localizer" ref="localizer"/> ! </object></programlisting> ! <para>For more information on configuring localizers see <xref linkend="web-localizers" /></para> ! </sect2> ! ! <sect2 id="web-globalresources"> ! <title>Global Message Sources</title> ! ! <para>The last two resource definitions from the previous section require some additional ! explanation:</para> ! ! <programlisting> ! <data name="$this.saveButton.Text"> ! <value>$messageSource.save</value> ! </data> ! <data name="$this.cancelButton.Text"> ! <value>$messageSource.cancel</value> ! </data> ! </programlisting> ! ! <para>In some cases it makes sense to apply a resource that is defined ! <emphasis>globally</emphasis> as opposed to locally. In this example, it ! makes better sense to define values for the <literal>Save</literal> and ! <literal>Cancel</literal> buttons globally as they will probably be used ! throughout the application.</para> <para>The above example demonstrates how one can achieve that by *************** *** 1678,1694 **** source lookup using the correct culture.</para> ! <tip> ! <para>To view the .resx file for a page, you may need to enable ! "Project/Show All Files" in Visual Studio.NET. When "Show All Files" ! is enabled, the .resx file appears like a "child" of the code-behind ! page.</para> ! <para>When Visual Studio.NET creates the .resx file, it will include a ! <literal>xds:schema</literal>element and several ! <literal>reshead</literal> elements. Your data elements will follow ! the <literal>reshead</literal> elements. When working with the .resx ! files, you may want to chose "Open With" from the context menu and ! select the "Source Code" text editor.</para> ! </tip> </sect2> --- 1688,1717 ---- source lookup using the correct culture.</para> ! <para>Global resources are (on a per-context basis) defined as a plain ! vanilla object definition using the reserved name of ! <literal>'messageSource'</literal>, which one can add to one's ! Spring.NET configuration file as shown below.</para> ! <programlisting><object id="messageSource" type="Spring.Context.Support.ResourceSetMessageSource, Spring.Core"> ! <property name="ResourceManagers"> ! <list> ! <value>MyApp.Web.Resources.Strings, MyApp.Web</value> ! </list> ! </property> ! </object></programlisting> ! ! <para>The global resources are cached within the Spring.NET ! <classname>IApplicationContext</classname> and are accessible through ! the Spring.NET <literal>IMessageSource</literal> interface.</para> ! ! <para>The Spring.Web <literal>Page</literal> and ! <literal>UserControl</literal> classes have a reference to their owning ! <classname>IApplicationContext</classname> and it's associated ! <literal>IMessageSource</literal>. As such, they will automatically ! redirect resource lookups to a global message source if a local resource ! cannot be found.</para> ! ! <para>Currently, the <literal>ResourceSetMessageSource</literal> is the ! only message source implementation that ships with Spring.NET.</para> </sect2> *************** *** 1855,1889 **** </sect2> - <sect2 id="web-globalresources"> - <title>Global Resources</title> - - <para>Global resources are (on a per-context basis) defined as a plain - vanilla object definition using the reserved name of - <literal>'messageSource'</literal>, which one can add to one's - Spring.NET configuration file as shown below.</para> - - <programlisting><object id="messageSource" type="Spring.Context.Support.ResourceSetMessageSource, Spring.Core"> - <property name="ResourceManagers"> - <list> - <value>MyApp.Web.Resources.Strings, MyApp.Web</value> - </list> - </property> - </object></programlisting> - - <para>The global resources are cached within the Spring.NET - <classname>IApplicationContext</classname> and are accessible through - the Spring.NET <literal>IMessageSource</literal> interface.</para> - - <para>The Spring.Web <literal>Page</literal> and - <literal>UserControl</literal> classes have a reference to their owning - <classname>IApplicationContext</classname> and it's associated - <literal>IMessageSource</literal>. As such, they will automatically - redirect resource lookups to a global message source if a local resource - cannot be found.</para> - - <para>Currently, the <literal>ResourceSetMessageSource</literal> is the - only message source implementation that ships with Spring.NET.</para> - </sect2> - <sect2 id="web-culture"> <title>User Culture Management</title> --- 1878,1881 ---- |