Re: [OFBiz] Users - Re: i18n of Entity Labels (the end)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Users - Re: i18n of Entity Labels (the end)

Jacques Le Roux
Administrator
David,

From: "David E. Jones" <[hidden email]>


>
> Jacques,
>
> It's good to have this on the mailing list, but perhaps it wasn't
> necessary to include the entire conversation... I'll slim it down to
> the more relevant recent parts.
>
> It looks like you having it right (barring some typo I'm missing
> here). Chances are if you look in the log file you'll see messages
> are problems with this... Note that when properties files are found
> it only reports it ONCE (if I remember right, I changed it to do that
> because having hundreds of messages was annoying), so you may have to
> look back a way, but just search in the log for the name of the
> properties file you specified.
>
> Speaking of specifying the name of the properties file to use... Did
> you put a "default-resource-name" attribute on the ProductCategory
> entity definition? If so and it's still not working could you send
> your entity def over? This attribute is necessary so that the Entity
> Engine will now which properties file to look in for localized
> override strings for that entity.
You are right I forgot to set a "default-resource-name" attribute on the
ProductCategory. Now it's working, I get "Gizmos français".


> Another note, which you can ignore if you feel you are getting too
> much information: ProductCategory already has other mechanisms for
> internationlization, and this feature of the entity engine should NOT
> be used with that entity! For Products and ProductCategorys the i18n
> is done through ProductContent and ProductCategoryContent,
> respectively, and it can be managed 100% in the online tools, meaning
> you don't have to translate those in properties files.... For more
> information on this, look for posts about the alternate locale
> related content feature of the content rendering/management stuff.

This was only for test, now it works and I'll forget "default-resource-name"
attribute on the ProductCategory and file ProductEntityLabels.properties.  I
(re)saw Manuel Meyer mail "Category description localization - newbiee
question" and the link to
http://ofbizwiki.go-integral.com/Wiki.jsp?page=LocalizedProductDescriptions.
Some questions :
Is the wiki tutorial for product applicable for Category or do we use what
is described in Manuel Meyer mail (attached) ?
Are there other contexts (than products and categories descriptions) where
this can be applied ?

I also noted that entity-name="ProductType" has already a
default-resource-name="ProductEntityLabels". But the file
ProductEntityLabels.properties did not exist before I created it temporaly
for test. Just a remark, perhaps useful ?

Thanks David for your kindness and patience with me :o)

> -David
>
>
> On Jul 13, 2005, at 4:40 PM, Jacques Le Roux wrote:
>
> > David,
> >
> > Thanks, your answer, it's completly clear. I tried your
> > recommandations :
> >
> > In "applications/product/config/ProductEntityLabels.properties" file
> > ProductCategory.description.100 = English Gizmos
> > (in _fr)
> > ProductCategory.description.100 = Gizmos en fran\u00E7ais
> >
> > {productCategory.description} as it was before my change in
> > applications/product/widget/catalog/CategoryScreens.xml
> > exactly
> > <label style="head1">${uiLabelMap.${labelTitleProperty}}
> > ${uiLabelMap.CommonFor}: ${productCategory.description}
> > [${uiLabelMap.CommonId}:${productCategoryId}]
> > ${${extraFunctionName}}</label>
> >
> > It's still not working : I get only "Gizmos" and not "Gizmos en
> > français" as
> > expected
> >
> > I get exactly :
> > <span class="head1">Catégorie pour: Gizmos [Réf.:100]  </span>
> >
> > As recommended, I send on ML, sorry for the long post folks...
> >
> > Jacques
> >
> > ===============================================
> >
> > Jacques,
> >
> > Syntax errors are no reason to throw out a way of doing things...
> >
> > First, the "productCategory.description.100 = Gizmos" line in the
> > properties file needs to have a capital "P" in ProductCategory, it is
> > case sensitive. I'd also avoid spaces, through they should work.
> >
> > Second, the get("fieldName", locale) method can ONLY be used in FTL
> > files. The string expander in the screen, form, etc files is aware of
> > Maps, Lists, etc, but NOT methods so that won't work there. How are
> > you trying to use it in the screens file? In most cases in the form
> > and screen widgets when you refer to an GenericValue field using the
> > "." syntax to treat it as a Map it will still detect that it is a
> > "LocalizedMap" and it will pass in the locale parameter. So, all you
> > have to do is use "productCategory.description" and it will localize
> > it in the screen and form widgets.
> >
> > BTW, if you are comfortable with it these questions should really go
> > onto the mailing lists. It doesn't solve the problem, but it does
> > tend to reduce the amount of times I have to answer a question.
> >
> > Thanks again for your help on the i18n and l10n efforts, I hope this
> > explanation is understandable...
> >
> > -David
> >
> >
> > On Jul 13, 2005, at 11:54 AM, Jacques Le Roux wrote:
> >
> >
> >> David,
> >>
> >> I tried to use the same scheme, than the one I use in ftl files, in
> >> xml
> >> files (for screen widget rendering) .
> >>
> >> Putting "{productCategory.get("description",locale)" in
> >> <applications/product/widget/catalog/CategoryScreens.xml> after
> >> having
> >> created an <applications/product/config/
> >> ProductEntityLabels.properties> file
> >> with at least "productCategory.description.100 = Gizmos" in it, I
> >> got :
> >>
> >> org.ofbiz.base.util.GeneralException: Error rendering screen
> >> [EditCategory]:
> >> org.ofbiz.base.util.GeneralException: Error rendering screen
> >> [CommonCategoryDecorator]: org.ofbiz.base.util.GeneralException:
> >> Error
> >> rendering screen [main-decorator]:
> >> java.lang.IllegalArgumentException:
> >> [GenericEntity.get] "get("description",locale)" is not a field of
> >> ProductCategory ([GenericEntity.get] "get("description",locale)" is
> >> not a
> >> field of ProductCategory) (Error rendering screen [main-decorator]:
> >> java.lang.IllegalArgumentException: [GenericEntity.get]
> >> "get("description",locale)" is not a field of ProductCategory
> >> ([GenericEntity.get] "get("description",locale)" is not a field of
> >> ProductCategory)) (Error rendering screen [CommonCategoryDecorator]:
> >> org.ofbiz.base.util.GeneralException: Error rendering screen
> >> [main-decorator]: java.lang.IllegalArgumentException:
> >> [GenericEntity.get]
> >> "get("description",locale)" is not a field of ProductCategory
> >> ([GenericEntity.get] "get("description",locale)" is not a field of
> >> ProductCategory) (Error rendering screen [main-decorator]:
> >> java.lang.IllegalArgumentException: [GenericEntity.get]
> >> "get("description",locale)" is not a field of ProductCategory
> >> ([GenericEntity.get] "get("description",locale)" is not a field of
> >> ProductCategory)))
> >>
> >> Do you think that this scheme is usable in xml files, and if yes,
> >> how to
> >> write it ?
> >>
> >> I had a discussion about this subject with Olivier. He told me he
> >> tried also
> >> (I think about march 2005, as I seen some get("description",locale)
> >> in ftl
> >> files) but never succeed.
> >>
> >> Now Néréide has opted for another way and translated in french all
> >> (or most)
> >> of *data.xml files (where we can find Enumeration description for
> >> example).
> >> I know it's not i18n but only l10n. But I think, after have done
> >> the work I
> >> do now on Enumeration Entity, I will use their work and wait
> >> sometime before
> >> coping with other parts of this job...
> >>
> >> What do you think about that ?
> >>
> >> Jacques
> >>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
>

Hi All,

 

I’ve investigated the problem on my own, sorry to annoy the group with dumb questions…

 

I’ve digged into the BSH/FTL couples and went up to the following point, in order to show localized categories.

I would like just to know if the solution I am thinking about is a non-sens, or wether this could be considered as a relative approach when facing the problem.

 

I’ve done the same content/dataresource association with alternate locale than the one described for product in the article

 

http://ofbizwiki.go-integral.com/Wiki.jsp?page=LocalizedProductDescriptions

 

Then, in /ofbiz/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/sidedeepcategory.bsh, I’ve added

 

catIterator = UtilMisc.toIterator(request.getAttribute("topLevelList"));

if(catIterator != null) {

            catContentWrappers = new HashMap();

            while(catIterator.hasNext()) {

                        cat = catIterator.next();

                CategoryContentWrapper catContentWrapper = new CategoryContentWrapper(cat, request);

                id = cat.get("productCategoryId");

                catContentWrappers.put(id, catContentWrapper);

            }

            context.put("catContentWrappers", catContentWrappers);

}

And in /ofbiz/applications/ecommerce/webapp/ecommerce/catalog/sidedeepcategory.ftl, I’ve changed

${category.description?if_exists}

In

${catContentWrappers[category.productCategoryId].get("description")}

 

And it looks like working. I now need to do that change on very ftl using categories – that is what I suppose.

 

I would also like to add that the more I digg in ofbiz, the impressed I am. Lots of excellent things to learn.

 

Best regards,

Manuel

 


De : [hidden email] [mailto:[hidden email]] De la part de Manuel Meyer
Envoyé : Wednesday, April 13, 2005 12:23 AM
À : [hidden email]
Objet : [OFBiz] Users - Category description localization - newbiee question

 

Hi All,

 

I would like to localize products and categories in at least 3 languages.

I’ve been able to localize the product name and description using the very nice Wiki ‘how to localize product’s description’ – need less to say I was very impressed by the feature. I’ve done the same with category but it did not give me any results.

 

Am I doing something wrong or is the process different ?

 

Thanks you for your answer,

 

Regards,

Manuel


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Users - Re: i18n of Entity Labels (the end)

Jacques Le Roux
Administrator
I'm confused after having seen
http://ofbizwiki.go-integral.com/Wiki.jsp?page=HowToLocalizeAnOFBizAppl.

All is clearly explained.

Sorry for annoyance everybody and especially David.

Jacques

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users