forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1749435 - Use Fluent to localize
bookmarks.html
at run-time rat…
…her than build-time. r=flod,mak,fluent-reviewers This modernizes an old part of the build system to not require build-time localization at all. That's generally preferable. The most significant changes to the in-product functionality is to make import localize HTML so that we can use Fluent's `data-l10n-id`. The locale used is the user's current locale. This is different than the existing approach, which always uses the build-time (repack) locale. I believe this is a strictly superior user experience and it may lead to future improvements where-in the default bookmarks become truly dynamic and vary with the user's chosen locale rather than being point-in-time decisions. I tried to restrict these changes to only applen when we import the default bookmarks, but I think the various layers of flags no longer achieve this restriction in practice and the formatting and localization will apply to all imported `bookmarks.html` files. Since we don't anticipate (nor ourselves write) these new things in (respectively, to) `bookmarks.html`, and the file is already user-controlled, I don't think this exposes any meaningful change in functionality (or in security surface). Some notes: 1) There's no migration of `.inc` -> `.ftl` because this is the lone `.inc` file. 2) I elected to prefix all strings with `default-bookmarks-`, since the existing names were very short and likely to collide (now or in the future). 3) I elected to change the HTML file name for easier searching. 4) Since the `default-bookmarks.html` file is product-specific and the existing tests are in `toolkit/`, I elected to not test the file directly in automation. 5) We removed the explicit locale (or equivalent `%LOCALE%`) since Mozilla properties will redirect to the appropriate language automatically. Differential Revision: https://phabricator.services.mozilla.com/D135816
- Loading branch information
Showing
13 changed files
with
186 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
browser/locales/en-US/browser/profile/default-bookmarks.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
# This file intentionally uses hard-coded brand names instead of Fluent terms. | ||
# This approach minimizes issues across multiple release channels and rebranded | ||
# versions. | ||
|
||
default-bookmarks-title = Bookmarks | ||
default-bookmarks-heading = Bookmarks | ||
default-bookmarks-toolbarfolder = Bookmarks Toolbar Folder | ||
default-bookmarks-toolbarfolder-description = Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar | ||
# link title for https://www.mozilla.org/firefox/central/ | ||
default-bookmarks-getting-started = Getting Started | ||
# Firefox links folder name | ||
default-bookmarks-firefox-heading = Mozilla Firefox | ||
# link title for https://www.mozilla.org/firefox/help/ | ||
default-bookmarks-firefox-get-help = Get Help | ||
# link title for https://www.mozilla.org/firefox/customize/ | ||
default-bookmarks-firefox-customize = Customize Firefox | ||
# link title for https://www.mozilla.org/contribute/ | ||
default-bookmarks-firefox-community = Get Involved | ||
# link title for https://www.mozilla.org/about/ | ||
default-bookmarks-firefox-about = About Us | ||
# Firefox Nightly links folder name | ||
default-bookmarks-nightly-heading = Firefox Nightly Resources | ||
# Nightly builds only, link title for https://blog.nightly.mozilla.org/ | ||
default-bookmarks-nightly-blog = Firefox Nightly blog | ||
# Nightly builds only, link title for https://bugzilla.mozilla.org/ | ||
default-bookmarks-bugzilla = Mozilla Bug Tracker | ||
# Nightly builds only, link title for https://developer.mozilla.org/ | ||
default-bookmarks-mdn = Mozilla Developer Network | ||
# Nightly builds only, link title for https://addons.mozilla.org/firefox/addon/nightly-tester-tools/ | ||
default-bookmarks-nightly-tester-tools = Nightly Tester Tools | ||
# Nightly builds only, link title for about:crashes | ||
default-bookmarks-crashes = All your crashes | ||
# Nightly builds only, link title for https://planet.mozilla.org/ | ||
default-bookmarks-planet = Planet Mozilla |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,6 @@ | |
|
||
@[email protected]: | ||
% locale browser @AB_CD@ %locale/browser/ | ||
# bookmarks.html is produced by LOCALIZED_GENERATED_FILES. | ||
locale/browser/bookmarks.html (bookmarks.html) | ||
|
||
locale/browser/accounts.properties (%chrome/browser/accounts.properties) | ||
locale/browser/browser.properties (%chrome/browser/browser.properties) | ||
locale/browser/customizableui/customizableWidgets.properties (%chrome/browser/customizableui/customizableWidgets.properties) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
toolkit/components/places/tests/unit/bookmarks_html_localized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE NETSCAPE-Bookmark-file-1> | ||
<!-- This is an automatically generated file. | ||
It will be read and overwritten. | ||
DO NOT EDIT! --> | ||
<HTML> | ||
<HEAD> | ||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | ||
<TITLE>Bookmarks</TITLE> | ||
<LINK REL="localization" HREF="bookmarks_html_localized.ftl"> | ||
</HEAD> | ||
<BODY> | ||
<H1 LAST_MODIFIED="1177541029">Bookmarks</H1> | ||
|
||
<DL><p> | ||
<DT><H3 ID="rdf:#$ZvPhC3" data-l10n-id="bookmarks-html-localized-folder">bookmarks-html-localized-folder</H3> | ||
<DL><p> | ||
<DT><A HREF="http://www.mozilla.com/firefox/help/" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==" ID="rdf:#$22iCK1" data-l10n-id="bookmarks-html-localized-bookmark">bookmarks-html-localized-bookmark</A> | ||
</DL><p> | ||
</DL><p> | ||
</BODY> | ||
</HTML> |
Oops, something went wrong.