Closed Bug 386322 Opened 17 years ago Closed 17 years ago

Localized metadata fails for multiple properties (contributor, translator, developer)

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.9alpha7

People

(Reporter: mossop, Assigned: mossop)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 1 obsolete file)

There's a problem which stops the localizable property values for the multiple choice properties from being retrieved.
Attached patch patch rev 1 (obsolete) — Splinter Review
Have to return an array of resources rather than an enumerator of resources from rdfGets.

We could alternatively make GetTargets handle an enumerator return rather than converting the enumerator to an array then wrapping with an ArrayEnumerator. But that muddies the API a little.
Attachment #270323 - Flags: review?(robert.bugzilla)
Comment on attachment 270323 [details] [diff] [review]
patch rev 1

>Index: toolkit/mozapps/extensions/src/nsExtensionManager.js.in
>===================================================================
>RCS file: /cvsroot/mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in,v
>retrieving revision 1.223
>diff -u8 -p -r1.223 nsExtensionManager.js.in
>--- toolkit/mozapps/extensions/src/nsExtensionManager.js.in	25 Jun 2007 21:38:19 -0000	1.223
>+++ toolkit/mozapps/extensions/src/nsExtensionManager.js.in	29 Jun 2007 13:39:05 -0000	
>@@ -8157,23 +8157,27 @@ ExtensionsDataSource.prototype = {
>    *    extensions.{GUID}.[contributor].1
>    *    extensions.{GUID}.[contributor].2
>    *    extensions.{GUID}.[contributor].3
>    *    ...
>    *
>    * to specify localized text for each of these properties.
>    */
>   _getLocalizablePropertyValues: function(item, property) {
>+    var values = [];
>     var localized = this._getLocalizedResource(item);
>-    if (localized)
>-      return this._inner.GetTargets(localized, property, true);
>+    if (localized) {
>+      var targets = this._inner.GetTargets(localized, property, true);
>+      while (targets.hasMoreElements())
>+      	values.push(targets.getNext());
stray tab
>+      return values;
>+    }

I think this should first try to get the pref values and if those aren't present try to get the values from rdf to maintain the previous behavior where a pref can override an extension's metadata.
Attachment #270323 - Flags: review?(robert.bugzilla) → review-
Same is true for _getLocalizablePropertyValue... is there a reason why the previous behavior should be changed? If not please fix _getLocalizablePropertyValue as well. Thanks!
Attached patch patch rev 2Splinter Review
Well my reasoning was that the new information would supercede the old way but there we go.
Attachment #270323 - Attachment is obsolete: true
Attachment #270430 - Flags: review?(robert.bugzilla)
Will need to update the documentation for this change.
Keywords: dev-doc-needed
(In reply to comment #4)
> Created an attachment (id=270430) [details]
> patch rev 2
> 
> Well my reasoning was that the new information would supercede the old way but
> there we go.
I'd say it is preferable to use the extension metadata but what about the case where a locale pack for an add-on is provided for an add-on that has localized metadat and is already released? The locale pack wouldn't be able to override the add-on provided metadata then.
Attachment #270430 - Attachment is patch: true
Attachment #270430 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 270430 [details] [diff] [review]
patch rev 2

Thanks Dave!
Attachment #270430 - Flags: review?(robert.bugzilla) → review+
Checking in toolkit/mozapps/extensions/src/nsExtensionManager.js.in;
/cvsroot/mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in,v  <--  nsExtensionManager.js.in
new revision: 1.225; previous revision: 1.224
done
Updated http://developer.mozilla.org/en/docs/Localizing_extension_descriptions to match the new behaviour.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3 M7
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: