Agreed! Thank you! 2008/7/3 Adrian Crum <[EMAIL PROTECTED]>:
> Keep it simple: > > <set field="ProductOnlyShowingFirstN" > value="${uiLabelMap.ProductOnlyShowingFirstN}"/> > > and > > ${ProductOnlyShowingFirstN} > > -Adrian > > > Bruno Busco wrote: > >> Adrian, >> yes I did read your solution and now I have also tested and solved the >> problem. >> Thank you. >> >> BTW, since this is something that will happen more than once (above all if >> we replace some splitted english-ordered sentences with a whole label) I >> ask >> for a best practice to do it. >> I propose the one that I have implemented right now as following: >> >> In order to display the following UILabel: >> <property key="ProductOnlyShowingFirstN"> >> <value xml:lang="en">NOTE: Only showing the first ${viewSize} of >> ${listSize} products. To view the rest, use the Products tab for this >> category.</value> >> <value xml:lang="it">NOTA: Sono elencati solo ${viewSize} di >> ${listSize} >> prodotti. Per visualizzare gli altri, usa il pannello Prodotti di questa >> categoria.</value> >> </property> >> >> I have used the following line in the actions tag: >> <set field="uiLabelMap_ProductOnlyShowingFirstN" >> value="${uiLabelMap.ProductOnlyShowingFirstN}"/> >> >> and the following line in the .FTL file >> ${uiLabelMap_ProductOnlyShowingFirstN} >> >> >> So the guideline could be that the field used has the same name has the >> UiLabel except the "." replaced by the "_" >> >> Does this make sense? >> >> Thank you, >> Bruno >> >> P.S. >> To implement this it has been necessary to change the screen xml file and >> the ftl file. >> I also tried to use the #assign tag in order to have this local to the >> .FTL >> file with the following lines: >> >> <#assign uiLabelMap_ProductOnlyShowingFirstN = >> uiLabelMap.ProductOnlyShowingFirstN> >> <div>${uiLabelMap_ProductOnlyShowingFirstN}.</div> >> >> but this does not work :-( >> There are no way to make this work? >> >> 2008/7/3 BJ Freeman <[EMAIL PROTECTED]>: >> >> Ok sorry now it makes sense. >>> my languages are limited but like in spanish the sentence structure is >>> different than english so the placement of the variables would be >>> different. >>> >>> so the approach have the $() in the uilabels files is what you are >>> suggesting. >>> >>> Bruno Busco sent the following on 7/3/2008 1:15 AM: >>> >>>> So the only solution is to split the strings and have the ${} into the >>>> >>> ftl ? >>> >>>> It is not the case to think to implement an iterative strings rendering >>>> until no more ${} are found? >>>> (this is why I used dev ml) >>>> >>>> This would also solve the issue that splitting the sentence in several >>>> labels it is necessary to stick to english words order that generally is >>>> different from other languages. >>>> >>>> Thank you >>>> -Bruno >>>> >>>> 2008/7/3 BJ Freeman <[EMAIL PROTECTED]>: >>>> >>>> probably should be in user ml >>>>> use >>>>> uiLabelMap.yourstringid >>>>> then move the text to >>>>> config/name of fileUiLabels.xml >>>>> >>>>> take a look at CatalogCommonScreens.xml for where you may find the >>>>> UiLabels.xml files like >>>>> <property-map resource="ProductUiLabels" >>>>> map-name="uiLabelMap" global="true"/> >>>>> <property-map resource="CommonUiLabels" >>>>> map-name="uiLabelMap" global="true"/> >>>>> >>>>> note you will have to break it up so the $() stay in the ftl, i >>>>> believe. >>>>> >>>>> >>>>> Bruno Busco sent the following on 7/2/2008 11:15 PM: >>>>> >>>>>> Thank you very much for your suggestions, I have been able to answer >>>>>> >>>>> you >>> >>>> only now... >>>>>> >>>>>> The issue, i think, is not related to the availability of the >>>>>> >>>>> information >>> >>>> in >>>>> >>>>>> the context, the two variables are already defined in the context. The >>>>>> problem I have is that the UI label rendering should do a "double >>>>>> >>>>> rendering" >>>>> >>>>>> and it seems not to do so. >>>>>> >>>>>> I try to better explain (sorry for the message length). >>>>>> >>>>>> I am working on the file >>>>>> \applications\product\webapp\catalog\find\miniproductlist.ftl. At >>>>>> lines >>>>>> 46-50 of this file there is the following: >>>>>> <#if (listSize > viewSize)> >>>>>> <div> >>>>>> <div>NOTE: Only showing the first ${viewSize} of >>>>>> ${listSize} products. To view the rest, use the Products tab for this >>>>>> category.</div> >>>>>> </div> >>>>>> </#if> >>>>>> >>>>>> The viewSize and listSize variables are correctly rendered since they >>>>>> >>>>> are >>> >>>> correctly defined in the context by the miniproductlist.groovy script. >>>>>> The problem is that this string is english only and I would like to >>>>>> transform in a standard UiLabel, so I added the following in the >>>>>> ProductUiLabels.xml file: >>>>>> >>>>>> <property key="ProductOnlyShowingFirstN"> >>>>>> <value xml:lang="en">NOTE: Only showing the first ${viewSize} >>>>>> >>>>> of >>> >>>> ${listSize} products. To view the rest, use the Products tab for this >>>>>> category.</value> >>>>>> <value xml:lang="it">NOTA: Sono elencati solo ${viewSize} di >>>>>> ${listSize} prodotti. Per visualizzare gli altri, usa il pannello >>>>>> >>>>> Prodotti >>>>> >>>>>> di questa categoria.</value> >>>>>> </property> >>>>>> >>>>>> and replaced the above lines in the miniproductlist.ftl file with the >>>>>> following: >>>>>> >>>>>> <#if (listSize > viewSize)> >>>>>> <div> >>>>>> <div>${uiLabelMap.ProductOnlyShowingFirstN}</div> >>>>>> </div> >>>>>> </#if> >>>>>> >>>>>> well, in this case what I get on the screen is the following: >>>>>> >>>>>> NOTE: Only showing the first ${viewSize} of ${listSize} products. To >>>>>> >>>>> view >>> >>>> the rest, use the Products tab for this category. >>>>>> >>>>>> where you can see that the variables are not rendered even if they are >>>>>> defined in the context. >>>>>> >>>>>> In my opinion a cyclic rendering should be done on the string until no >>>>>> >>>>> more >>>>> >>>>>> ${} are found because all have been rendered. >>>>>> >>>>>> I think that this is the reason why in many cases labels are divided >>>>>> >>>>> into >>> >>>> several labels (sometimes of one word only) that are then included in >>>>>> >>>>> ftl >>> >>>> files to form the whole sentence. Doing this can be a workaround for >>>>>> >>>>> the >>> >>>> variables rendering (because the variables are not included in the >>>>>> >>>>> UiLabels >>>>> >>>>>> string but in the ftl directly) but we already discussed in the ML >>>>>> that >>>>>> >>>>> this >>>>> >>>>>> should be avoided because it imposes the english words order that is >>>>>> >>>>> often >>>>> >>>>>> different for other languages. >>>>>> >>>>>> Many thanks, >>>>>> -Bruno >>>>>> >>>>>> >>>>>> 2008/6/30 Ashish Vijaywargiya <[EMAIL PROTECTED]>: >>>>>> >>>>>> Hello Bruno, >>>>>>> >>>>>>>> Unfortunately I see that the parameters ${viewSize} and ${listSize} >>>>>>>> >>>>>>> are >>> >>>> not >>>>>>> >>>>>>>> rendered as expected but the whole string is displayed as it appears >>>>>>>> >>>>>>> in >>> >>>> the >>>>>>> >>>>>>>> UiLabel.xml file. >>>>>>>> >>>>>>> ${viewSize} and ${listSize} means that we should put this values in >>>>>>> >>>>>> the >>> >>>> screen context first then this will be available in the UiLabel.xml >>>>>>> file.Suppose you are preparing context in the *Screens.xml then you >>>>>>> >>>>>> should >>>>> >>>>>> write down something like this :- >>>>>>> >>>>>>> <set field="viewSize" value="2"/> >>>>>>> <set field="listSize" value="2"/> >>>>>>> >>>>>>> Or if you would like to put this values in the *.bsh file that is >>>>>>> >>>>>> included >>>>> >>>>>> in your *Screens.xml file then you should write down the following >>>>>>> >>>>>> code. >>> >>>> context.put("viewSize","2"); >>>>>>> context.put("listSize","2"); >>>>>>> >>>>>>> If you are keeping your values in the parameters then you should read >>>>>>> >>>>>> the >>>>> >>>>>> values from the parameters map inside your UiLabel.xml file. >>>>>>> In this case you will read by ${parameters.viewSize} & >>>>>>> ${parameters.listSize} >>>>>>> For example :- >>>>>>> <set field="parameters.viewSize" value="2"/> >>>>>>> <set field="parameters.listSize" value="2"/> >>>>>>> >>>>>>> & while putting the values in *.bsh >>>>>>> >>>>>>> parameters.put("viewSize","2"); >>>>>>> parameters.put("listSize","2"); >>>>>>> >>>>>>> You should notice that in the screen definition all the Decorator >>>>>>> >>>>>> comes >>> >>>> after setting this context values and decorator includes(set) the >>>>>>> >>>>>> values >>> >>>> from Property Files.So all the values kept in the context(either in >>>>>>> parameters or context map) will be available in those *UiLabel.xml >>>>>>> >>>>>> files. >>>>> >>>>>> And for the localization thing I agree from the Scott's comment. >>>>>>> So I think I am safe on that point :-) >>>>>>> >>>>>>> Please let us know if you still have some more question. >>>>>>> >>>>>>> -- >>>>>>> Ashish >>>>>>> >>>>>>> >>>>>>> On Sun, Jun 29, 2008 at 2:25 PM, Scott Gray <[EMAIL PROTECTED]> >>>>>>> >>>>>> wrote: >>> >>>> Hi Bruno >>>>>>>> >>>>>>>> I think you're looking for something like this: >>>>>>>> UtilProperties.getMessage(resource, >>>>>>>> "AccountingAdditionalShippingChargeForShipment", >>>>>>>> UtilMisc.toMap("shipmentId", shipmentId), locale); >>>>>>>> >>>>>>>> Regard >>>>>>>> >>>>>>>> 2008/6/29 Bruno Busco <[EMAIL PROTECTED]>: >>>>>>>> >>>>>>>> Hi, >>>>>>>>> I am trying to add the following UiLabel that includes some >>>>>>>>> >>>>>>>> parameters >>> >>>> <property key="ProductOnlyShowingFirstN"> >>>>>>>>> <value xml:lang="en">NOTE: Only showing the first ${viewSize} >>>>>>>>> >>>>>>>> of >>>>> >>>>>> ${listSize} products. To view the rest, use the Products tab for >>>>>>>>> >>>>>>>> this >>> >>>> category.</value> >>>>>>>>> <value xml:lang="it">NOTA: Sono elencati solo ${viewSize} di >>>>>>>>> ${listSize} prodotti. Per visualizzare gli altri, usa il pannello >>>>>>>>> >>>>>>>> Prodotti >>>>>>>> >>>>>>>>> di questa categoria.</value> >>>>>>>>> </property> >>>>>>>>> >>>>>>>>> I would like to use it in miniproductlist.ftl to replace an english >>>>>>>>> constant >>>>>>>>> text. >>>>>>>>> Unfortunately I see that the parameters ${viewSize} and ${listSize} >>>>>>>>> >>>>>>>> are >>>>> >>>>>> not >>>>>>>> >>>>>>>>> rendered as expected but the whole string is displayed as it >>>>>>>>> appears >>>>>>>>> >>>>>>>> in >>>>> >>>>>> the >>>>>>>> >>>>>>>>> UiLabel.xml file. >>>>>>>>> >>>>>>>>> What is the correct way to display parametrized labels? >>>>>>>>> >>>>>>>>> Many thanks, >>>>>>>>> Bruno >>>>>>>>> >>>>>>>>> >>> >>