Author: tv Date: Thu May 3 07:09:06 2007 New Revision: 534874 URL: http://svn.apache.org/viewvc?view=rev&rev=534874 Log: Cleaned up a conflict
Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/localization-service.xml Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/localization-service.xml URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/localization-service.xml?view=diff&rev=534874&r1=534873&r2=534874 ============================================================================== --- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/localization-service.xml (original) +++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/services/localization-service.xml Thu May 3 07:09:06 2007 @@ -89,10 +89,8 @@ <section name="Usage"> <source><![CDATA[ - TurbineServices.getInstance().getService(LocalizationService.LOCALIZATION) .getString("LABEL_ORGANIZATION"); - ]]></source> <p> @@ -100,22 +98,18 @@ </p> <source><![CDATA[ - Localization.getString("LABEL_ORGANIZATION"); - ]]></source> <p> The hard example above was given as an example of using Services. The easy example is the one that you really should be using. Another cool feature -of the Localization class is that you can pass in a RunData object like +of the Localization class is that you can pass in a HttpRequest object like this: </p> <source><![CDATA[ - -Localization.getString(data, "LABEL_ORGANIZATION"); - +Localization.getString("LABEL_ORGANIZATION", data.getRequest()); ]]></source> <p> @@ -125,10 +119,26 @@ </p> <p> -Equivalents of the format() methods illustrated below are also available for -handling localized strings with arguments defined as "{0}", "{1}", etc. +The Localization class also supports the formatting of localized strings containing +parameters, such as in </p> +<source><![CDATA[ +Localization.format(Localization.getDefaultBundle(), + Localization.getLocale(data.getRequest(), + "CURRENT_RECORD", + recno, all); +]]></source> + +<p> +This actually doesn't look too nice, however the call using the LocalizationTool +from a Velocity template (see below) just deflates to +</p> + +<source><![CDATA[ +$l10n.format("CURRENT_RECORD", $recno, $all); +]]></source> + </section> <section name="Usage from a template"> @@ -136,7 +146,7 @@ <p> Turbine provides a <a href="../pullmodel-howto.html">Pull tool</a> to make it very easy to access localized text from within your templates. To configure -this you need to add the following to your TrubineResouces.properties: +this you need to add the following to your TurbineResouces.properties: </p> <source><![CDATA[ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]