Closed Bug 1446164 Opened 7 years ago Closed 2 years ago

Use Fluent in autofill edit dialogs

Categories

(Toolkit :: Form Autofill, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: MattN, Assigned: eemeli)

References

(Blocks 5 open bugs)

Details

(Whiteboard: [webpayments-reserve])

User Story

* cc-exp-month dropdown hyphen

Attachments

(1 file)

The <form>s in editCreditCard.xhtml and editAddress.xhtml are used in about:preferences and in the unprivileged Payment Request dialog. The latter means they can't easily use properties files like they are now. We should switch them to use Fluent to l10n can be done the same way in both privileged and unprivileged contexts.
Whiteboard: [webpayments]
Reminder to delete browser/extensions/formautofill/content/l10n.js and remove the <script> when fixing this.
Product: Toolkit → Firefox
See Also: → 1462149
Any chance you could convert these two xhtml documents soon? It's kinda blocking QA for Web Payments as we can't render any strings currently when the documents are used in our unprivileged PaymentRequest dialog. You don't need to focus on the unprivileged aspect for this bug… I can handle that separately I just don't know how to do the Fluent conversion myself.
Flags: needinfo?(gandalf)
Yeah, I'll look into this after I complete bug 1407418.
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #3) > Yeah, I'll look into this after I complete bug 1407418. (In reply to Matthew N. [:MattN] (PM if requests are blocking you) from comment #2) > I can handle that separately I just don't know how to do the Fluent conversion myself. Just an FYI, it will help me test solutions for bug 1407418 if this conversion is done in advance of that (working in it's chrome:// context).
What do you not know how to do? The tutorial is here: https://firefox-source-docs.mozilla.org/intl/l10n/l10n/index.html You can find all the migrations we did so far here: bug 1415730, and as far as I see you need to 1) inject the `<script>` with l10n.js 2) move the content of browser/extensions/formautofill/locales/en-US/formautofill.properties to browser/locales/en-US/browser/extensions/formautofill/formautofill.ftl 3) put `<link rel="localization" href="browser/extensions/formautofill/formautofill.ftl"/>` in the document 4) switch all the `data-localization` with `data-l10n-id` 5) Put the patch here, Flod will help you with the migration patch Is that a good start?
Flags: needinfo?(gandalf) → needinfo?(MattN+bmo)
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #5) > What do you not know how to do? The tutorial is here: > https://firefox-source-docs.mozilla.org/intl/l10n/l10n/index.html > … > 5) Put the patch here, Flod will help you with the migration patch This is the part I didn't know how to do… I didn't realize Flod would do that for me.
Blocks: 1451579
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #5) > 2) move the content of > browser/extensions/formautofill/locales/en-US/formautofill.properties to > browser/locales/en-US/browser/extensions/formautofill/formautofill.ftl formautofill.properties is used for non-preference strings too (including in autocomplete popups that run in browser.xul): https://dxr.mozilla.org/mozilla-central/search?q=formautofill.properties Is it fine to migrate only some strings to ftl from that file? (In reply to Matthew N. [:MattN] (PM if requests are blocking you) from comment #6) > (In reply to Zibi Braniecki [:gandalf][:zibi] from comment #5) > > What do you not know how to do? The tutorial is here: > > https://firefox-source-docs.mozilla.org/intl/l10n/l10n/index.html > > … > > 5) Put the patch here, Flod will help you with the migration patch > > This is the part I didn't know how to do… I didn't realize Flod would do > that for me. Just to double-check… I can make the new .ftl file and then the Python script will be generated from that after with some magic?
Flags: needinfo?(MattN+bmo) → needinfo?(gandalf)
(In reply to Matthew N. [:MattN] (PM if requests are blocking you) from comment #7) > formautofill.properties is used for non-preference strings too (including in > autocomplete popups that run in browser.xul): > https://dxr.mozilla.org/mozilla-central/search?q=formautofill.properties > > Is it fine to migrate only some strings to ftl from that file? Yes, although you have to make some strategic decisions about it. If you eventually plan to use a single FTL file for both uses, locate it in a structure that later will be shared between all uses. If you want to fork into two FTL files, place the one you want now in analogous structure to your XUL/XHTML/JS, and then when we'll be migrating the other use case, we'll put the other FTL fork close to its use. We generally discourage overoptimizations around localization. The experience is that an engineer wants to "reuse strings" and eventually ends up needing slightly different strings or use them in slightly different context/UI and it ends up in a mess. For that reason a general rule is that you should aim for one FTL file per UI piece (document?) and maybe another "helper" FTL for shared resources. But in cases where the split UI is an artifact of some platform limitations and there's a strong intend to keep both UIs in sync, it may make sense to have a single FTL file for both uses. > (In reply to Matthew N. [:MattN] (PM if requests are blocking you) from > comment #6) > > (In reply to Zibi Braniecki [:gandalf][:zibi] from comment #5) > > > What do you not know how to do? The tutorial is here: > > > https://firefox-source-docs.mozilla.org/intl/l10n/l10n/index.html > > > … > > > 5) Put the patch here, Flod will help you with the migration patch > > > > This is the part I didn't know how to do… I didn't realize Flod would do > > that for me. > > Just to double-check… I can make the new .ftl file and then the Python > script will be generated from that after with some magic? hahaha. I wish! We have some helper scripts, but the core magic we use is either I or Flod writing the migration scripts. We're trying t make it easy and hopefully we'll be able to automate some of it, but picking good IDs is tricky and there's enough complex cases where old strings uses concatenation, or some other bad practice, and we have to migrate in a non-trivial way, that so far we rely on humans.
Flags: needinfo?(gandalf)
OK… interesting… (In reply to Zibi Braniecki [:gandalf][:zibi] from comment #5) > 2) move the content of > browser/extensions/formautofill/locales/en-US/formautofill.properties to > browser/locales/en-US/browser/extensions/formautofill/formautofill.ftl Hmm… I'm not sure this makes sense given that formautofill is a system add-on and therefore should be self-contained in its own directory IMO. Can I simply use the same directory or is that not supported yet?
Flags: needinfo?(gandalf)
> Hmm… I'm not sure this makes sense given that formautofill is a system add-on and therefore should be self-contained in its own directory IMO. Can I simply use the same directory or is that not supported yet? It can be, but you need to add jar.mn entry to the extension's jar.mn analogous to https://searchfox.org/mozilla-central/source/browser/locales/jar.mn#10-11
Flags: needinfo?(gandalf)
I'm just going to leave this bug for you then and try and postpone web payments QA as my guts says that the the jar.mn entry isn't going to just work and there will be problems with the https://searchfox.org/mozilla-central/source/browser/locales/jar.mn#10-11 wildcard packaging the system add-on strings a second time…
Depends on: 1463292
This depends on system add-on support for Fluent which isn't ready yet. We have bug 1463292 as our short-term solution to support basic usability of the add/edit forms.
Priority: P2 → P3
Whiteboard: [webpayments] → [webpayments-reserve]
Depends on: 1473772
Depends on: 1492593
Depends on: 1492597
User Story: (updated)
See Also: → 1762640
Blocks: 1675814
Blocks: 1786788

I'm working on a solution to this, as the autofill edit dialogs are some of the last DTD users in m-c.

Assignee: nobody → earo
Status: NEW → ASSIGNED
Component: WebPayments UI → Form Autofill
No longer depends on: 1473772, 1492593, 1492597
Product: Firefox → Toolkit
See Also: 1762640
Summary: Use Fluent in autofill edit dialogs so they can be localized when used in the unprivileged PaymentRequest dialog → Use Fluent in autofill edit dialogs
Version: Trunk → unspecified

Migrating the strings used by the edit dialogs also allows/requires for their migration elsewhere.

Some streamlining is applied to how autofillEditForms.js gets access to e.g. FormFillUtils methods, so that they are no longer routed via the XHTML files' script tags. The prior independence of this file from internal dependencies appears to have been in place to support its use as a part of the Payments API's UI, but that was dropped in bug 1721229.

The Fluent migration script included in this patch also covers changes from the immediately preceding patch.

The intl documentation change is a typo correction that was noticed while working on this patch.

Depends on D155478

Pushed by earo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/469e2500f00e Migrate formautofill edit dialogs to Fluent. r=sgalich,fluent-reviewers,flod

Backed out for causing multiple failures

Backout link

Push with failures

Failure log 1

There's also this gv-junit failure . Here's the failure log for it (this failure line too).

Flags: needinfo?(earo)

The handling of unsupported credit card networks was broken. I'm not sure why I didn't catch this in my prior testing. A try push of the broken tests for the updated patch seems to be happy: https://treeherder.mozilla.org/jobs?repo=try&revision=1109cb3a8f2dd35624f3cb6167af570adc07f9ad

Flags: needinfo?(earo)
Pushed by earo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/51f4fcd096f9 Migrate formautofill edit dialogs to Fluent. r=sgalich,fluent-reviewers,flod
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: