Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 234154

Summary: Names in .properties files are not used for site categories
Product: [Eclipse Project] Equinox Reporter: Sue Estrada <estradas>
Component: p2Assignee: Dave Stevenson <dstevens>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cfraser, dstevens, john.arthorne, mpcarl, pascal, simon_kaegi
Version: 3.4Flags: john.arthorne: review+
simon_kaegi: review+
pascal: review+
Target Milestone: 3.4 RC3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 234942    
Attachments:
Description Flags
small example to recreate the problem
none
Add localization to category IUs when generation metadata for an update site
none
New example
none
Updated patch v02
none
Updated patch v03 none

Description Sue Estrada CLA 2008-05-27 09:52:28 EDT
Build ID: I20080516-1333

Steps To Reproduce:
1.We have a category such as this in our site.xml file:
<category-def name="desktop" label="%category.developer"/>
2. %category.developer is set and contained in a .properties file for purposes of translation.
3.When installing with P2, the category name is shown as %category.developer instead of using the name in the .properties file.


More information:
Comment 1 Pascal Rapicault CLA 2008-05-27 10:01:49 EDT
Sue, could you please provide us a sample update site we could use to reproduce this problem?
Comment 2 Sue Estrada CLA 2008-05-27 10:52:30 EDT
Created attachment 102161 [details]
small example to recreate the problem

Created a reduced test case from our install site .zip.
Comment 3 Pascal Rapicault CLA 2008-05-27 22:07:33 EDT
Simon, please investigate.
Comment 4 Dave Stevenson CLA 2008-05-29 17:30:16 EDT
Created attachment 102763 [details]
Add localization to category IUs when generation metadata for an update site

Attaching a patch that incorporates translations into IUs when using the metadata generator to p2-ize a local (file:) update site.

The patch does not affect the on-the-fly generation of metadata for non-p2-ized update sites since the that would involve more substantial work to search for and read property files for the locales with translations. This additional work has some risk of bugs that might break reading sites. The workaround for such sites where category info has been translated is run metadata generation - speeding up the access to the site as well as including the translations.
Comment 5 Dave Stevenson CLA 2008-05-29 17:31:38 EDT
Request review of the patch by John.
Comment 6 John Arthorne CLA 2008-05-29 19:07:26 EDT
Created attachment 102778 [details]
New example

Dave's patch works for a site with one category, but it doesn't seem to work with multiple categories. I have to go home but I'll try to resume later.
Comment 7 John Arthorne CLA 2008-05-29 19:09:25 EDT
Created attachment 102779 [details]
Updated patch v02

Two fixes from previous patch:
 - Previous patch was checking for localized category name, but the name can't be translated - it's the category id
 - The case of loading a site from a jar was looking for a "feature.properties" instead of "site.properties". This looked like a C&P bug.
Comment 8 John Arthorne CLA 2008-05-29 22:45:21 EDT
Created attachment 102793 [details]
Updated patch v03

Previous patch was missing the fix to replace "feature" with "site"
Comment 9 Simon Kaegi CLA 2008-05-30 00:25:50 EDT
I noticed a typo in the site.xml in John's example. It's on the id of "org.eclipse.releng"t".tools. After removing the "t" I see both categories in the content.jar and the UI.

One thing I noticed is that each category contains the default translations for every other category in the site. Perhaps not critical however we should consider partitioning these.
Comment 10 John Arthorne CLA 2008-05-30 11:44:11 EDT
I tested again with a corrected site and it works. I think we can live with the multiple category translations showing up in each category, and fix that for 3.5.
Comment 11 Pascal Rapicault CLA 2008-05-30 11:45:28 EDT
I have verified that with the patch I can see the categories properly translated.
Comment 12 Simon Kaegi CLA 2008-05-30 12:05:27 EDT
The updatesite jar code in Generator.getFeatureToCategoryMappings doesn't look like it will ever run and could be removed. Now is probably not the right time to do this so +1 with a comment there to remind us.

I also looked at pruning category translations and agree this is a 3.5 thing.
Comment 13 John Arthorne CLA 2008-05-30 12:20:08 EDT
Released.