ma1 pushed to branch base-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
eba10c40
by hackademix at 2023-07-11T16:45:09+02:00
3 changed files:
- toolkit/content/widgets/moz-support-link/moz-support-link.mjs
- toolkit/mozapps/extensions/content/aboutaddons.html
- toolkit/mozapps/extensions/content/aboutaddons.js
Changes:
... | ... | @@ -52,6 +52,23 @@ export default class MozSupportLink extends HTMLAnchorElement { |
52 | 52 | this.setAttribute("target", "_blank");
|
53 | 53 | this.addEventListener("click", this);
|
54 | 54 | if (!this.getAttribute("data-l10n-id")) {
|
55 | + const fixupL10nId = this.getAttribute("data-basebrowser-l10n-fixup");
|
|
56 | + if (fixupL10nId) {
|
|
57 | + document.l10n.formatValue(fixupL10nId).then(title => {
|
|
58 | + this.setAttribute("title", title);
|
|
59 | + // NOTE: Mozilla adds identical aria-label and title attributes. This is
|
|
60 | + // generally bad practice because this link has no text content, so the
|
|
61 | + // title alone will already act as the accessible name.
|
|
62 | + // Normally setting both aria-label and title will lead to the title being
|
|
63 | + // used as the accessible description, but since they are identical
|
|
64 | + // the LocalAccessible::Description method will make an exception and keep
|
|
65 | + // the description empty.
|
|
66 | + // Since this component is outside of our fork's control, we follow the
|
|
67 | + // same practice just in case Mozilla ever adds some text content.
|
|
68 | + this.setAttribute("aria-label", title);
|
|
69 | + });
|
|
70 | + return;
|
|
71 | + }
|
|
55 | 72 | document.l10n.setAttributes(this, "moz-support-link-text");
|
56 | 73 | }
|
57 | 74 | document.l10n.translateFragment(this);
|
... | ... | @@ -359,6 +359,7 @@ |
359 | 359 | is="moz-support-link"
|
360 | 360 | support-page="add-on-badges"
|
361 | 361 | utm-content="promoted-addon-badge"
|
362 | + data-basebrowser-l10n-fixup="basebrowser-addon-badge-recommended"
|
|
362 | 363 | hidden
|
363 | 364 | >
|
364 | 365 | </a>
|
... | ... | @@ -376,6 +377,7 @@ |
376 | 377 | is="moz-support-link"
|
377 | 378 | support-page="add-on-badges"
|
378 | 379 | utm-content="promoted-addon-badge"
|
380 | + data-basebrowser-l10n-fixup="basebrowser-addon-badge-verified"
|
|
379 | 381 | hidden
|
380 | 382 | >
|
381 | 383 | </a>
|
... | ... | @@ -4220,29 +4220,6 @@ async function initialize() { |
4220 | 4220 | );
|
4221 | 4221 | }
|
4222 | 4222 | }
|
4223 | - |
|
4224 | - // At the moment we need to do this, because Weblate still does not support
|
|
4225 | - // attributes in Fluent.
|
|
4226 | - const [recommended, verified] = await document.l10n.formatValues([
|
|
4227 | - { id: "basebrowser-addon-badge-recommended" },
|
|
4228 | - { id: "basebrowser-addon-badge-verified" },
|
|
4229 | - ]);
|
|
4230 | - |
|
4231 | - importTemplate("card");
|
|
4232 | - _templates.card.content
|
|
4233 | - .querySelector(".addon-badge-recommended")
|
|
4234 | - .setAttribute("title", recommended);
|
|
4235 | - _templates.card.content
|
|
4236 | - .querySelector(".addon-badge-verified")
|
|
4237 | - .setAttribute("title", verified);
|
|
4238 | - |
|
4239 | - // We also update any template copy that has already been created.
|
|
4240 | - for (const badge of document.querySelectorAll(".addon-badge-recommended")) {
|
|
4241 | - badge.setAttribute("title", recommended);
|
|
4242 | - }
|
|
4243 | - for (const badge of document.querySelectorAll(".addon-badge-verified")) {
|
|
4244 | - badge.setAttribute("title", verified);
|
|
4245 | - }
|
|
4246 | 4223 | }
|
4247 | 4224 | |
4248 | 4225 | window.promiseInitialized = new Promise(resolve => {
|