Align and improve the fluent.js <--> mozilla-central build integration

NEW
Unassigned

Status

()

enhancement
P3
normal
a year ago
2 months ago

People

(Reporter: gandalf, Unassigned)

Tracking

(Blocks 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

The current integration of fluent.js code into mozilla-central is suboptimal on several levels:

 - rollup doesn't produce code we can put into m-c without changes
 - our linting rules are in conflict with mozilla's
 - we don't have docs in intl/l10n/ to explain how to pull new fluent.js into Gecko
 - we need to agree on how to express customizations of Fluent classes for Gecko
(Reporter)

Updated

a year ago
Blocks: 1365426
Priority: -- → P3
>  - we don't have docs in intl/l10n/ to explain how to pull new fluent.js
> into Gecko

Zibi -- can you sketch how this works here?  Easier than docs, but will help me understand some things about how Fluent integrates into m-c.
Flags: needinfo?(gandalf)
(Reporter)

Comment 2

a year ago
> Zibi -- can you sketch how this works here?

Currently it works like this:

1) clone https://github.com/projectfluent/fluent.js
2) go to fluent-gecko directory
3) npm i
4) make
5) In ./dist directory you now have MessageContext.jsm, Localization.jsm, DOMLocalization.jsm and l10n.js

Those files are built using packages `fluent` and `fluent-dom` and some custom code from `fluent-gecko/src`.

Now, rollup did most of the work, but not all, so we unfortunately can't just copy&paste those files into `mozilla-unified/intl/l10n` like we would like to.

Instead we'll apply them there, and then go through `hg diff` and manually look for which changes should be and which are now obsolete.

This is the wrinkle that I aim to remove as it basically puts a bus factor 1 with me being the only person who without a hassle knows what the diff should look like.

There's a diff that one can use to get a general sense in `https://searchfox.org/mozilla-central/source/intl/l10n/fluent.js.patch` - those are the changes that recently were between the output of `fluent-gecko/dist` and m-u/intl/l10n.

This of course doesn't apply cleanly whenever we land a patch in Gecko, so I need to sync it.

There were several patches that landed in m-c at the end of 60 cycle and one more that landed today into 61. I plan to upstream it to fluent.js repo and work on separating out GeckoLocalization and GeckoDOMLocalization classes to make the `fluent.js.patch` smaller.

From the perspective of vendoring in Node modules - if we could vendor in npm packages `fluent` and `fluent-dom` and somehow load them into .jsm files, I would be able to remove the whole integration and just keep the fluent-gecko code in Gecko.

Which is what I hope we'll end up with :)
Flags: needinfo?(gandalf)
You need to log in before you can comment on or make changes to this bug.