Closed Bug 1438748 Opened 6 years ago Closed 5 years ago

Migrate AS from react-intl to fluent-react

Categories

(Firefox :: New Tab Page, enhancement, P3)

enhancement

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox60 --- wontfix

People

(Reporter: zbraniecki, Unassigned)

References

(Blocks 1 open bug)

Details

Mardak says that AS is currently using react-intl.

Mozilla is migrating all our assets to Fluent localization system and we provide react bindings in form of fluent-react package.

Migrating AS to it would mean that you don't have to export from react-intl to .properties (Pontoon supports Fluent!) and AS l10n resources and API calls are in sync with that of Firefox which makes integration way easier.

Here are intro docs for how to use fluent-react - https://github.com/projectfluent/fluent.js/wiki/React-Bindings
react-intl was added for the test pilot add-on in https://github.com/mozilla/activity-stream/pull/2110
Thinking about it, it would give your team a lot of benefits:

 - Your current funnel (json -> .properties) probably severely limits l10n features you can use. Fluent would give you plural rules, genders, declensions, variable interpolations, date/number formatting right-to-left etc. out of the box.
 - Fluent has also a nice set of features on its own including DOM Overlays (for localization of DOM fragments), and soon things like pseudolocales

Looking at your current .properties file you seem to keep the strings very simple, but I guess it must be rather a result of the toolchain, and I expect you could use some of the features now or soon :)
kate, could you weigh in on this one?
Flags: needinfo?(khudson)
Kate - the l10n drivers team would be happy to answer any questions you may have (we hang out on IRC - :stas, :pike, :gandalf can be found on #l10n, #l20n, #developers, #fx-team etc.)

fluent-react is used by all new Mozilla projects and we're transitioning Firefox to it: https://wiki.mozilla.org/Fluent

You can find additional resources on the localization system at projectfluent.org and our wiki has articles explaining the design decisions and comparisons to other systems like the one used by react-intl (messageformat) - https://github.com/projectfluent/fluent/wiki
After taking a look at some of the documentation, it looks like it would be relatively straight-forward for us to migrate to Fluent (the API is pretty compatible with how we do things now), although obviously it would be a fairly large change set. We don't have a immediate need for some of the more advanced features, although it would give us more flexibility in the future. It would also be nice to simplify our build system :)

Overall, this seems reasonable to me, it would really just a matter of taking the time to do it.
Flags: needinfo?(khudson)
Priority: -- → P3
Not sure if this directly depends on bug 1425104 for web extensions, but we can probably learn from the stuff there.
See Also: → 1425104
See Also: → 1457223
Blocks: 1485002
Depends on: 1455649
Severity: normal → enhancement
Blocks: 1500192

Current plan for the various bugs under bug 1485002 is to use native fluent-dom (although there's various uses of fluent-react for asrouter related content)

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
Component: Activity Streams: Newtab → New Tab Page
You need to log in before you can comment on or make changes to this bug.