Closed Bug 1133725 Opened 9 years ago Closed 9 years ago

Langpacks: rename languages-provided.ab-CD.version to "revision"

Categories

(Core Graveyard :: DOM: Apps, defect)

defect
Not set
normal

Tracking

(firefox36 wontfix, firefox37 wontfix, firefox38 fixed, b2g-v2.2 fixed, b2g-master fixed)

RESOLVED FIXED
mozilla38
Tracking Status
firefox36 --- wontfix
firefox37 --- wontfix
firefox38 --- fixed
b2g-v2.2 --- fixed
b2g-master --- fixed

People

(Reporter: stas, Assigned: stas)

References

Details

Attachments

(1 file, 4 obsolete files)

For consistency with all other "version" fields in the manifest, it might make sense to change the version of the language resources included in the langpack to be a string.

This way it's up to the user-code to decide how to compare to language versions.

Relevant code:

  http://mxr.mozilla.org/mozilla-central/source/dom/apps/Langpacks.jsm#195
It looks like we do the comparison of language versions in platform, too:

  http://mxr.mozilla.org/mozilla-central/source/dom/apps/Langpacks.jsm#251

We'd need to convert the version to an int for this to work if we go ahead with this change proposed in this bug.  Same in l10n.js, where we're already doing it implicitly:

  https://github.com/mozilla-b2g/gaia/blob/e4956b2ecd5357ba4aa7604ca2ab244b01366f7a/shared/js/l10n.js#L1708

Zibi, Fabrice -- what do you think about this?  Is it worth it to keep the "version" field of "langpacks-provided" consistent wrt. type with other version fields in the manifest?
Flags: needinfo?(gandalf)
Flags: needinfo?(fabrice)
In order to avoid more confusion in the future, would it make sense to rename this field to "timestamp", of type string?
"timestamp" or something similar would make more sense IMHO. Having a "version" field that's actually an integer and not compatible with a lot of version numbering schemes developers use is confusing (I made the mistake when implementing langpacks in Marketplace, I thought that the version field not being a string was a typo, because of the inconsistency with the other "version" field at the root of the manifest).
(In reply to Staś Małolepszy :stas from comment #1)

> Zibi, Fabrice -- what do you think about this?  Is it worth it to keep the
> "version" field of "langpacks-provided" consistent wrt. type with other
> version fields in the manifest?

I have no preference. The langpack version is the only one we actually use on the platform side so I'm fine we doing changes there if needed.
Flags: needinfo?(fabrice)
The W3C spec [1] doesn't even define the "version" field and MDN explicitly states that it's not used by the runtime [2].  This is different from what we're doing with languages-provided.ab-CD.version: it *is* used by the runtime in places which I listed in comment 1.  This is bound to create confusion.

The runtime needs to compare two language versions and in order to do so it has expectations re. the type of the version field. It needs to know how to compare them.  Making it a string would complicate this by letting third-party developers believe they can use any versioning scheme they like.

My suggestion is to:

  - rename languages-provided.ab-CD.version to languages-provided.ab-CD.revision to avoid confusion caused by the fact that other "version" fields in the manifest are usually of string type,
  - keep it as an integer type,
  - explicitly state in the langpack spec that the revisions need to be comparable with the "<" operator.

This will involve a little bit of juggling since we'd need to land this in Gecko 37 and 38 and Gaia 2.0 and master.

[1] https://w3c.github.io/manifest/
[2] https://developer.mozilla.org/en-US/Apps/Build/Manifest#version
Summary: Langpacks: change languages-provided.ab-CD.version to a string → Langpacks: rename languages-provided.ab-CD.version to "revision"
Comment on attachment 8565884 [details] [review]
[gaia] stasm:1133725-langpack-revision > mozilla-b2g:master

th: https://treeherder.mozilla.org/#/jobs?repo=gaia-try&revision=5c0bd04c3068
Attachment #8565884 - Flags: review?(gandalf)
Comment on attachment 8565897 [details] [diff] [review]
[gecko] rename language versions to revisions

Review of attachment 8565897 [details] [diff] [review]:
-----------------------------------------------------------------

lgtm, thanks Staś !
Attachment #8565897 - Flags: review?(fabrice) → review+
Comment on attachment 8565897 [details] [diff] [review]
[gecko] rename language versions to revisions

Review of attachment 8565897 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/webidl/Apps.webidl
@@ +10,5 @@
>  };
>  
>  dictionary LanguageDesc {
>    DOMString target;
> +  DOMString revision;

Fabrice, since we want revision to be an int, do I need to change this here somehow?
(In reply to Staś Małolepszy :stas from comment #11)
> Comment on attachment 8565897 [details] [diff] [review]
> [gecko] rename language versions to revisions
> 
> Review of attachment 8565897 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/webidl/Apps.webidl
> @@ +10,5 @@
> >  };
> >  
> >  dictionary LanguageDesc {
> >    DOMString target;
> > +  DOMString revision;
> 
> Fabrice, since we want revision to be an int, do I need to change this here
> somehow?

Ha you're right. Change that to be a `long` instead.
I changed the webidl definition of "revision" to long.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=fc50c134d29c
Assignee: nobody → stas
Attachment #8565897 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8565928 - Flags: review?(fabrice)
Comment on attachment 8565884 [details] [review]
[gaia] stasm:1133725-langpack-revision > mozilla-b2g:master

lgtm. Thanks stas!
Flags: needinfo?(gandalf)
Attachment #8565884 - Flags: review?(gandalf) → review+
Attachment #8565928 - Flags: review?(fabrice) → review+
Adding checkin-needed for both Gecko and Gaia patches.
Keywords: checkin-needed
Autolander could not locate a review from a user within the suggested reviewer list. Either the patch author or the reviewer should be in the suggested reviewer list.
Blocks: 1134536
Comment on attachment 8566426 [details] [review]
[gaia] stasm:1134536-langpack-revision > mozilla-b2g:master

Wrong bug, sorry.
Attachment #8566426 - Attachment is obsolete: true
Comment on attachment 8565884 [details] [review]
[gaia] stasm:1133725-langpack-revision > mozilla-b2g:master

Moved to bug 1134536.
Attachment #8565884 - Attachment is obsolete: true
Keywords: checkin-needed
this needs dom peer review for the idl change
Flags: needinfo?(stas)
Keywords: checkin-needed
Comment on attachment 8565928 [details] [diff] [review]
[gecko] rename language versions to revisions, patch 2

Jonas, can you review the change to dom/webidl/Apps.webidl?  This bug is about changing the name of the "version" property of languages inside langpacks to "revision" to avoid confusion with string-typed "version" fields in other places of the manifest.  The type stays the same (int), but the webidl file didn't reflect that so I'm taking the opportunity here to fix that, too.
Flags: needinfo?(stas)
Attachment #8565928 - Flags: review?(jonas)
Comment on attachment 8565928 [details] [diff] [review]
[gecko] rename language versions to revisions, patch 2

Review of attachment 8565928 [details] [diff] [review]:
-----------------------------------------------------------------

r=me on the Apps.webidl part
Attachment #8565928 - Flags: review?(jonas) → review+
Comment on attachment 8565887 [details] [review]
[spec] rename language version to revision

Marking this pull request to the spec as obsolete as it's not really related to the Gecko implementation worked on in this bug.  (Merged in https://github.com/stasm/spec/commit/f3c4d8476279da6c1905bd6eb43c57115125a6b3)
Attachment #8565887 - Attachment is obsolete: true
Keywords: checkin-needed
Comment on attachment 8565928 [details] [diff] [review]
[gecko] rename language versions to revisions, patch 2

NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.

[Approval Request Comment]

Bug caused by (feature/regressing bug #): langpack spec change: "version" becomes "revision"  (langpacks are a FxOS 2.2 feature)

User impact if declined:  langpacks' manifests will have two different "version" fields of two different types: a string one for the version of the langpack and an integer type for the version of the language included in the langpack;  this is confusing and makes it easy to make mistakes

Testing completed: unit tests

Risk to taking this patch (and alternatives if risky):  low; it's basically a search & replace patch

String or UUID changes made by this patch:  none
Attachment #8565928 - Flags: approval-mozilla-b2g37?
https://hg.mozilla.org/mozilla-central/rev/d2c5ad87e7db
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Attachment #8565928 - Flags: approval-mozilla-b2g37? → approval-mozilla-b2g37+
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: