[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] 3 commits: fixup! Bug 40926: Implemented the New Identity feature



Title: GitLab

richard pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

  • 9ef44caa
    by Henry Wilkes at 2024-03-20T12:24:28+00:00
    fixup! Bug 40926: Implemented the New Identity feature
    
    Bug 42211: Migrate to Fluent.
    
  • 93302237
    by Henry Wilkes at 2024-03-20T12:24:28+00:00
    fixup! Base Browser strings
    
    Bug 42211: Migrate new identity to Fluent.
    
    Also change some strings to sentence case in en-US.
    
    Also removed the hard-coded "Tor Browser", which is not appropriate in
    base-browser (e.g. for Mullvad Browser).
    
  • 124ce63b
    by Henry Wilkes at 2024-03-20T12:24:29+00:00
    fixup! Tor Browser localization migration scripts.
    
    Bug 42211: Migrate new identity strings to Fluent.
    

10 changed files:

Changes:

  • browser/base/content/appmenu-viewcache.inc.xhtml
    ... ... @@ -57,6 +57,7 @@
    57 57
           <toolbarseparator/>
    
    58 58
           <toolbarbutton id="appMenu-new-identity"
    
    59 59
                          class="subviewbutton"
    
    60
    +                     data-l10n-id="appmenuitem-new-identity"
    
    60 61
                          key="new-identity-key"/>
    
    61 62
           <toolbarbutton id="appMenuNewCircuit"
    
    62 63
                          class="subviewbutton"
    

  • browser/base/content/browser-menubar.inc
    ... ... @@ -30,7 +30,7 @@
    30 30
                               key="key_privatebrowsing" data-l10n-id="menu-file-new-private-window"/>
    
    31 31
                     <menuseparator/>
    
    32 32
                     <menuitem id="menu_newIdentity"
    
    33
    -                          key="new-identity-key"/>
    
    33
    +                          key="new-identity-key" data-l10n-id="menu-new-identity"/>
    
    34 34
                     <menuitem id="menu_newCircuit"
    
    35 35
                               accesskey="&torbutton.context_menu.new_circuit_key;"
    
    36 36
                               key="new-circuit-key"
    

  • browser/base/content/navigator-toolbox.inc.xhtml
    ... ... @@ -617,7 +617,8 @@
    617 617
                        _ondragover_="newWindowButtonObserver.onDragOver(event)"
    
    618 618
                        _ondragenter_="newWindowButtonObserver.onDragOver(event)"/>
    
    619 619
     
    
    620
    -    <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"/>
    
    620
    +    <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
    
    621
    +                   data-l10n-id="toolbar-new-identity"/>
    
    621 622
     
    
    622 623
         <toolbarbutton id="new-circuit-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
    
    623 624
                        label="&torbutton.context_menu.new_circuit;"
    

  • browser/components/newidentity/content/newIdentityDialog.js
    ... ... @@ -5,20 +5,13 @@
    5 5
     document.addEventListener("dialogaccept", () => {
    
    6 6
       const retvals = window.arguments[0];
    
    7 7
       retvals.confirmed = true;
    
    8
    -  retvals.neverAskAgain = document.querySelector("#neverAskAgain").checked;
    
    8
    +  retvals.neverAskAgain = document.getElementById("neverAskAgain").checked;
    
    9 9
     });
    
    10 10
     
    
    11 11
     document.addEventListener("DOMContentLoaded", () => {
    
    12
    -  const { NewIdentityStrings } = window.arguments[0];
    
    13
    -  const dialog = document.querySelector("#newIdentityDialog");
    
    12
    +  const dialog = document.getElementById("newIdentityDialog");
    
    14 13
     
    
    15
    -  dialog.querySelector("#infoTitle").textContent =
    
    16
    -    NewIdentityStrings.new_identity_prompt_title;
    
    17
    -  dialog.querySelector("#infoBody").textContent =
    
    18
    -    NewIdentityStrings.new_identity_prompt;
    
    19
    -  dialog.querySelector("#neverAskAgain").label =
    
    20
    -    NewIdentityStrings.new_identity_ask_again;
    
    21 14
       const accept = dialog.getButton("accept");
    
    22
    -  accept.label = NewIdentityStrings.new_identity_restart;
    
    15
    +  document.l10n.setAttributes(accept, "new-identity-dialog-confirm");
    
    23 16
       accept.classList.add("danger-button");
    
    24 17
     });

  • browser/components/newidentity/content/newIdentityDialog.xhtml
    ... ... @@ -21,9 +21,8 @@
    21 21
     >
    
    22 22
       <dialog id="newIdentityDialog" buttons="accept,cancel" defaultButton="accept">
    
    23 23
         <linkset>
    
    24
    -      <!-- Without this document.l10n is not initialized, and we need it for the
    
    25
    -    cancel button. -->
    
    26 24
           <html:link rel="localization" href="">"branding/brand.ftl" />
    
    25
    +      <html:link rel="localization" href="">"browser/base-browser.ftl" />
    
    27 26
         </linkset>
    
    28 27
     
    
    29 28
         <div xmlns="http://www.w3.org/1999/xhtml">
    
    ... ... @@ -33,13 +32,18 @@
    33 32
                 <xul:image id="infoIcon" />
    
    34 33
               </div>
    
    35 34
               <div id="infoContainer">
    
    36
    -            <xul:description id="infoTitle" />
    
    35
    +            <xul:description
    
    36
    +              id="infoTitle"
    
    37
    +              data-l10n-id="new-identity-dialog-title"
    
    38
    +            />
    
    37 39
                 <xul:description
    
    38 40
                   id="infoBody"
    
    39
    -              context="contentAreaContextMenu"
    
    40
    -              noinitialfocus="true"
    
    41
    +              data-l10n-id="new-identity-dialog-description"
    
    42
    +            />
    
    43
    +            <xul:checkbox
    
    44
    +              id="neverAskAgain"
    
    45
    +              data-l10n-id="new-identity-dialog-never-ask-checkbox"
    
    41 46
                 />
    
    42
    -            <xul:checkbox id="neverAskAgain" />
    
    43 47
               </div>
    
    44 48
             </div>
    
    45 49
           </div>
    

  • browser/components/newidentity/content/newidentity.js
    1 1
     "use strict";
    
    2 2
     
    
    3
    -/* globals CustomizableUI Services gFindBarInitialized gFindBar
    
    4
    -   OpenBrowserWindow PrivateBrowsingUtils XPCOMUtils
    
    5
    - */
    
    6
    -
    
    7
    -XPCOMUtils.defineLazyGetter(this, "NewIdentityStrings", () => {
    
    8
    -  const brandBundle = Services.strings.createBundle(
    
    9
    -    "chrome://branding/locale/brand.properties"
    
    10
    -  );
    
    11
    -  const brandShortName = brandBundle.GetStringFromName("brandShortName");
    
    12
    -
    
    13
    -  const fallbackBundle = Services.strings.createBundle(
    
    14
    -    "resource:///chrome/en-US/locale/browser/newIdentity.properties"
    
    15
    -  );
    
    16
    -  const strings = {};
    
    17
    -  const brandedStrings = ["new_identity_prompt", "new_identity_restart"];
    
    18
    -  for (let { key } of fallbackBundle.getSimpleEnumeration()) {
    
    19
    -    strings[key] = fallbackBundle.GetStringFromName(key);
    
    20
    -  }
    
    21
    -  try {
    
    22
    -    const bundle = Services.strings.createBundle(
    
    23
    -      "chrome://browser/locale/newIdentity.properties"
    
    24
    -    );
    
    25
    -    for (const key of Object.keys(strings)) {
    
    26
    -      try {
    
    27
    -        strings[key] = bundle.GetStringFromName(key);
    
    28
    -      } catch (e) {}
    
    29
    -    }
    
    30
    -  } catch (e) {
    
    31
    -    console.warn("Could not load localized New Identity strings");
    
    32
    -  }
    
    33
    -  for (let key of brandedStrings) {
    
    34
    -    strings[key] = strings[key].replaceAll("%S", brandShortName);
    
    35
    -  }
    
    36
    -  return strings;
    
    37
    -});
    
    3
    +/* eslint-env mozilla/browser-window */
    
    38 4
     
    
    39 5
     // Use a lazy getter because NewIdentityButton is declared more than once
    
    40 6
     // otherwise.
    
    ... ... @@ -471,11 +437,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    471 437
                     // malformed URL, bail out
    
    472 438
                     return;
    
    473 439
                   }
    
    474
    -              const label =
    
    475
    -                NewIdentityStrings.new_identity_home_notification.replace(
    
    476
    -                  "%S",
    
    477
    -                  displayAddress
    
    478
    -                );
    
    479 440
                   const callback = () => {
    
    480 441
                     Services.prefs.setStringPref(trustedHomePref, homeURL);
    
    481 442
                     win.BrowserHome();
    
    ... ... @@ -484,12 +445,15 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    484 445
                   notificationBox.appendNotification(
    
    485 446
                     "new-identity-safe-home",
    
    486 447
                     {
    
    487
    -                  label,
    
    448
    +                  label: {
    
    449
    +                    "l10n-id": "new-identity-blocked-home-notification",
    
    450
    +                    "l10n-args": { url: displayAddress },
    
    451
    +                  },
    
    488 452
                       priority: notificationBox.PRIORITY_INFO_MEDIUM,
    
    489 453
                     },
    
    490 454
                     [
    
    491 455
                       {
    
    492
    -                    label: NewIdentityStrings.new_identity_home_load_button,
    
    456
    +                    "l10n-id": "new-identity-blocked-home-ignore-button",
    
    493 457
                         callback,
    
    494 458
                       },
    
    495 459
                     ]
    
    ... ... @@ -550,37 +514,20 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    550 514
           const button =
    
    551 515
             document.getElementById("new-identity-button") ||
    
    552 516
             window.gNavToolbox.palette.querySelector("#new-identity-button");
    
    553
    -      if (button) {
    
    554
    -        button.setAttribute("tooltiptext", NewIdentityStrings.new_identity);
    
    555
    -        // Include an equal label, shown in the overflow menu or during
    
    556
    -        // customization.
    
    557
    -        button.setAttribute("label", NewIdentityStrings.new_identity);
    
    558
    -        button.addEventListener("command", () => {
    
    559
    -          this.onCommand();
    
    560
    -        });
    
    561
    -      }
    
    562
    -      const viewCache = document.getElementById("appMenu-viewCache").content;
    
    563
    -      const appButton = viewCache.querySelector("#appMenu-new-identity");
    
    564
    -      if (appButton) {
    
    565
    -        appButton.setAttribute(
    
    566
    -          "label",
    
    567
    -          NewIdentityStrings.new_identity_sentence_case
    
    568
    -        );
    
    569
    -        appButton.addEventListener("command", () => {
    
    517
    +      button?.addEventListener("command", () => {
    
    518
    +        this.onCommand();
    
    519
    +      });
    
    520
    +      document
    
    521
    +        .getElementById("appMenu-viewCache")
    
    522
    +        .content.querySelector("#appMenu-new-identity")
    
    523
    +        ?.addEventListener("command", () => {
    
    570 524
               this.onCommand();
    
    571 525
             });
    
    572
    -      }
    
    573
    -      const menu = document.querySelector("#menu_newIdentity");
    
    574
    -      if (menu) {
    
    575
    -        menu.setAttribute("label", NewIdentityStrings.new_identity);
    
    576
    -        menu.setAttribute(
    
    577
    -          "accesskey",
    
    578
    -          NewIdentityStrings.new_identity_menu_accesskey
    
    579
    -        );
    
    580
    -        menu.addEventListener("command", () => {
    
    526
    +      document
    
    527
    +        .getElementById("menu_newIdentity")
    
    528
    +        ?.addEventListener("command", () => {
    
    581 529
               this.onCommand();
    
    582 530
             });
    
    583
    -      }
    
    584 531
         },
    
    585 532
     
    
    586 533
         uninit() {},
    
    ... ... @@ -598,7 +545,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    598 545
             const shouldConfirm = Services.prefs.getBoolPref(prefConfirm, true);
    
    599 546
             if (shouldConfirm) {
    
    600 547
               const params = {
    
    601
    -            NewIdentityStrings,
    
    602 548
                 confirmed: false,
    
    603 549
                 neverAskAgain: false,
    
    604 550
               };
    

  • browser/locales/en-US/browser/base-browser.ftl
    ... ... @@ -11,20 +11,19 @@ language-notification-label-system = { -brand-short-name } has set your display
    11 11
     language-notification-label = { -brand-short-name } has set your display language to { $language }.
    
    12 12
     language-notification-button = Change Language…
    
    13 13
     
    
    14
    -
    
    15 14
     ## Fullscreen/maximization notification shown when letterboxing is disabled
    
    16 15
     
    
    17 16
     basebrowser-rfp-maximize-warning-message = Maximizing the browser window can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave browser windows in their original default size.
    
    18 17
     basebrowser-rfp-restore-window-size-button-label = Restore
    
    19 18
     basebrowser-rfp-restore-window-size-button-ak = R
    
    20 19
     
    
    21
    -
    
    22 20
     ## Tooltip for the about:addons recommended badge
    
    23 21
     
    
    24 22
     basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance
    
    25 23
     basebrowser-addon-badge-verified = Mozilla has reviewed this extension to meet their standards for security and performance
    
    26 24
     
    
    27 25
     ## Option to show or hide the NoScript extension button/item.
    
    26
    +
    
    28 27
     basebrowser-addon-noscript-visibility-label = Toolbar button
    
    29 28
     basebrowser-addon-noscript-visibility-show = Show
    
    30 29
     basebrowser-addon-noscript-visibility-hide = Hide
    
    ... ... @@ -35,3 +34,39 @@ basebrowser-addon-noscript-visibility-hide = Hide
    35 34
     # $version (String) - The current browser version. E.g. "12.5.3".
    
    36 35
     # $firefoxVersion (String) - The version number of Firefox the current browser is based on. E.g. "102.15.0esr".
    
    37 36
     basebrowser-about-dialog-version = { $version } (based on Mozilla Firefox { $firefoxVersion })
    
    37
    +
    
    38
    +## New identity.
    
    39
    +
    
    40
    +# File menu items use title case for English (US).
    
    41
    +menu-new-identity =
    
    42
    +    .label = New Identity
    
    43
    +    .accesskey = I
    
    44
    +
    
    45
    +# App menu (hamburger menu) items use sentence case for English (US).
    
    46
    +appmenuitem-new-identity =
    
    47
    +    .label = New identity
    
    48
    +
    
    49
    +# Uses sentence case for English (US).
    
    50
    +# ".label" is the accessible name, and is visible in the overflow menu and when
    
    51
    +# customizing the toolbar.
    
    52
    +# ".tooltiptext" will be identical to the label.
    
    53
    +toolbar-new-identity =
    
    54
    +    .label = New identity
    
    55
    +    .tooltiptext = { toolbar-new-identity.label }
    
    56
    +
    
    57
    +## New identity dialog.
    
    58
    +
    
    59
    +new-identity-dialog-title = Reset your identity?
    
    60
    +new-identity-dialog-description = { -brand-short-name } will close all windows and tabs. All website sessions will be lost.
    
    61
    +new-identity-dialog-never-ask-checkbox =
    
    62
    +    .label = Never ask me again
    
    63
    +new-identity-dialog-confirm =
    
    64
    +    .label = Restart { -brand-short-name }
    
    65
    +
    
    66
    +## New identity: blocked home page notification.
    
    67
    +
    
    68
    +# '-brand-short-name' is the localized browser name, like "Tor Browser".
    
    69
    +# $url (String) - The URL of the home page, possibly shortened.
    
    70
    +new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session.
    
    71
    +# Button to continue loading the home page, despite the warning message.
    
    72
    +new-identity-blocked-home-ignore-button = Load it anyway

  • browser/locales/en-US/chrome/browser/newIdentity.properties deleted
    1
    -new_identity = New Identity
    
    2
    -# This is the string for the hamburger menu
    
    3
    -new_identity_sentence_case = New identity
    
    4
    -# %S is the application name. Keep it as a placeholder
    
    5
    -new_identity_prompt_title = Reset your identity?
    
    6
    -new_identity_prompt = %S will close all windows and tabs. All website sessions will be lost. \nRestart %S now to reset your identity?
    
    7
    -new_identity_restart = Restart %S
    
    8
    -new_identity_ask_again = Never ask me again
    
    9
    -# Shown in the File menu (use Alt to show File, if you do not see)
    
    10
    -new_identity_menu_accesskey = I
    
    11
    -new_identity_home_notification = Tor Browser blocked your homepage (%S) from loading because it might recognize your previous session.
    
    12
    -# %S is replaced with the custom homepage URL's domain if applicable, or some short-hand of it otherwise
    
    13
    -new_identity_home_load_button  = Load it anyway

  • browser/locales/jar.mn
    ... ... @@ -34,6 +34,5 @@
    34 34
         locale/browser/feeds/subscribe.properties       (%chrome/browser/feeds/subscribe.properties)
    
    35 35
         locale/browser/syncSetup.properties         (%chrome/browser/syncSetup.properties)
    
    36 36
         locale/browser/securityLevel.properties        (%chrome/browser/securityLevel.properties)
    
    37
    -    locale/browser/newIdentity.properties          (%chrome/browser/newIdentity.properties)
    
    38 37
         locale/browser/cryptoSafetyPrompt.properties    (%chrome/browser/cryptoSafetyPrompt.properties)
    
    39 38
     % locale browser-region @AB_CD@ %locale/browser-region/

  • tools/torbrowser/l10n/migrations/bug-42211-new-identity.py
    1
    +import fluent.syntax.ast as FTL
    
    2
    +from fluent.migrate.helpers import TERM_REFERENCE, transforms_from
    
    3
    +from fluent.migrate.transforms import REPLACE
    
    4
    +
    
    5
    +
    
    6
    +def migrate(ctx):
    
    7
    +    legacy_path = "newIdentity.properties"
    
    8
    +
    
    9
    +    ctx.add_transforms(
    
    10
    +        "base-browser.ftl",
    
    11
    +        "base-browser.ftl",
    
    12
    +        transforms_from(
    
    13
    +            """
    
    14
    +menu-new-identity =
    
    15
    +    .label = { COPY(path, "new_identity") }
    
    16
    +    .accesskey = { COPY(path, "new_identity_menu_accesskey") }
    
    17
    +appmenuitem-new-identity =
    
    18
    +    .label = { COPY(path, "new_identity_sentence_case") }
    
    19
    +toolbar-new-identity =
    
    20
    +    .label = { COPY(path, "new_identity_sentence_case") }
    
    21
    +    .tooltiptext = { toolbar-new-identity.label }
    
    22
    +
    
    23
    +new-identity-dialog-title = { COPY(path, "new_identity_prompt_title") }
    
    24
    +new-identity-dialog-never-ask-checkbox =
    
    25
    +    .label = { COPY(path, "new_identity_ask_again") }
    
    26
    +
    
    27
    +new-identity-blocked-home-ignore-button = { COPY(path, "new_identity_home_load_button") }
    
    28
    +""",
    
    29
    +            path=legacy_path,
    
    30
    +        )
    
    31
    +        + [
    
    32
    +            # Replace "%S" with "{ -brand-short-name }" in confirm button.
    
    33
    +            FTL.Message(
    
    34
    +                id=FTL.Identifier("new-identity-dialog-confirm"),
    
    35
    +                value=None,
    
    36
    +                attributes=[
    
    37
    +                    FTL.Attribute(
    
    38
    +                        id=FTL.Identifier("label"),
    
    39
    +                        value=REPLACE(
    
    40
    +                            legacy_path,
    
    41
    +                            "new_identity_restart",
    
    42
    +                            {"%1$S": TERM_REFERENCE("brand-short-name")},
    
    43
    +                        ),
    
    44
    +                    ),
    
    45
    +                ],
    
    46
    +            ),
    
    47
    +        ],
    
    48
    +    )

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits