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 1845150 - Update notificationbox usage for search engine removal …
…notification r=search-reviewers,fluent-reviewers,Standard8,bolsson Notification can be triggered locally via this snippet: ```js BrowserSearch.removalOfSearchEngineNotificationBox("Google", "Foogle") ``` Differential Revision: https://phabricator.services.mozilla.com/D194312
- Loading branch information
1 parent
f78c584
commit ba93129
Showing
5 changed files
with
45 additions
and
28 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
32 changes: 32 additions & 0 deletions
32
python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py
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,32 @@ | ||
# Any copyright is dedicated to the Public Domain. | ||
# http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
import re | ||
import fluent.syntax.ast as FTL | ||
from fluent.migrate.transforms import TransformPattern | ||
|
||
|
||
class STRIP_LABEL(TransformPattern): | ||
# Used to remove `<label data-l10n-name="remove-search-engine-article">` from a string | ||
def visit_TextElement(self, node): | ||
node.value = re.sub( | ||
'\s?<label data-l10n-name="remove-search-engine-article">.+?</label>\s?', | ||
"", | ||
node.value, | ||
) | ||
return node | ||
|
||
|
||
def migrate(ctx): | ||
"""Bug 1845150 - Use moz-message-bar instead of message-bar in notificationbox.js, part {index}.""" | ||
search_ftl = "browser/browser/search.ftl" | ||
ctx.add_transforms( | ||
search_ftl, | ||
search_ftl, | ||
[ | ||
FTL.Message( | ||
id=FTL.Identifier("removed-search-engine-message2"), | ||
value=STRIP_LABEL(search_ftl, "removed-search-engine-message"), | ||
), | ||
], | ||
) |