Hi to all,
while I'm testing some web site content I have discovered that if a ContentAssoc with contentAssocTypeId="ALTERNATE_LOCALE" is defined for a web site content it will be not used because the method renderSubContentBody of MacroScreenRenderer take the locale as default instead of take it from the context. I have tried to change the method renderSubContentBody in this way and seems to me it's now working: Index: framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java =================================================================== --- framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (revision 785768) +++ framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (working copy) @@ -18,17 +18,13 @@ *******************************************************************************/ package org.ofbiz.widget.screen; -import java.io.File; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.math.BigDecimal; -import java.net.MalformedURLException; -import java.net.URL; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Locale; import java.util.Map; @@ -38,16 +34,12 @@ import javolution.util.FastMap; -import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; -import org.ofbiz.base.util.FileUtil; -import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.template.FreeMarkerWorker; import org.ofbiz.entity.GenericDelegator; @@ -519,8 +511,8 @@ } public void renderSubContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { - // FIXME: copy those code from HtmlScreenRenderer.java - Locale locale = Locale.getDefault(); + // FIXME: copy those code from HtmlScreenRenderer.java + Locale locale = UtilMisc.ensureLocale(context.get("locale")); String mimeTypeId = "text/html"; String expandedContentId = content.getContentId(context); String expandedMapKey = content.getMapKey(context); Let me know if I have to open a Jira issue. Thanks in advance Marco |
Thank you Marco,
your fix is in rev. 785954 Jacopo On Jun 18, 2009, at 9:00 AM, [hidden email] wrote: > Hi to all, > > while I'm testing some web site content I have discovered that if a > ContentAssoc with contentAssocTypeId="ALTERNATE_LOCALE" is defined > for a > web site content it will be not used because the method > renderSubContentBody of MacroScreenRenderer take the locale as > default instead of take it from the context. > > I have tried to change the method renderSubContentBody in this way > and seems to me it's now working: > > Index: framework/widget/src/org/ofbiz/widget/screen/ > MacroScreenRenderer.java > =================================================================== > --- framework/widget/src/org/ofbiz/widget/screen/ > MacroScreenRenderer.java (revision 785768) > +++ framework/widget/src/org/ofbiz/widget/screen/ > MacroScreenRenderer.java (working copy) > @@ -18,17 +18,13 @@ > > *******************************************************************************/ > package org.ofbiz.widget.screen; > > -import java.io.File; > import java.io.IOException; > import java.io.Reader; > import java.io.StringReader; > import java.io.StringWriter; > import java.math.BigDecimal; > -import java.net.MalformedURLException; > -import java.net.URL; > import java.util.HashMap; > import java.util.HashSet; > -import java.util.List; > import java.util.Locale; > import java.util.Map; > > @@ -38,16 +34,12 @@ > > import javolution.util.FastMap; > > -import org.ofbiz.base.location.FlexibleLocation; > import org.ofbiz.base.util.Debug; > import org.ofbiz.base.util.GeneralException; > -import org.ofbiz.base.util.FileUtil; > -import org.ofbiz.base.util.StringUtil; > import org.ofbiz.base.util.UtilFormatOut; > import org.ofbiz.base.util.UtilGenerics; > import org.ofbiz.base.util.UtilHttp; > import org.ofbiz.base.util.UtilMisc; > -import org.ofbiz.base.util.UtilProperties; > import org.ofbiz.base.util.UtilValidate; > import org.ofbiz.base.util.template.FreeMarkerWorker; > import org.ofbiz.entity.GenericDelegator; > @@ -519,8 +511,8 @@ > } > > public void renderSubContentBody(Appendable writer, Map<String, > Object> context, ModelScreenWidget.SubContent content) throws > IOException { > - // FIXME: copy those code from HtmlScreenRenderer.java > - Locale locale = Locale.getDefault(); > + // FIXME: copy those code from HtmlScreenRenderer.java > + Locale locale = > UtilMisc.ensureLocale(context.get("locale")); > String mimeTypeId = "text/html"; > String expandedContentId = content.getContentId(context); > String expandedMapKey = content.getMapKey(context); > > > Let me know if I have to open a Jira issue. > > Thanks in advance > Marco > > smime.p7s (3K) Download Attachment |
Free forum by Nabble | Edit this page |