summaryrefslogtreecommitdiffstats
path: root/python/l10n/fluent_migrations
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /python/l10n/fluent_migrations
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'python/l10n/fluent_migrations')
-rw-r--r--python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py2
-rw-r--r--python/l10n/fluent_migrations/bug_1864340_autocomplete_footer.py59
-rw-r--r--python/l10n/fluent_migrations/bug_1864606_backlogged_crash_checkbox.py41
-rw-r--r--python/l10n/fluent_migrations/bug_1875957_web_appearance_warning.py40
4 files changed, 141 insertions, 1 deletions
diff --git a/python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py b/python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py
index 125baa4c1f..a519833d9c 100644
--- a/python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py
+++ b/python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py
@@ -10,7 +10,7 @@ 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?',
+ r'\s?<label data-l10n-name="remove-search-engine-article">.+?</label>\s?',
"",
node.value,
)
diff --git a/python/l10n/fluent_migrations/bug_1864340_autocomplete_footer.py b/python/l10n/fluent_migrations/bug_1864340_autocomplete_footer.py
new file mode 100644
index 0000000000..e389f54861
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1864340_autocomplete_footer.py
@@ -0,0 +1,59 @@
+# Any copyright is dedicated to the Public Domain.
+# http://creativecommons.org/publicdomain/zero/1.0/
+
+import fluent.syntax.ast as FTL
+from fluent.migrate.transforms import COPY, COPY_PATTERN
+
+
+def migrate(ctx):
+ """Bug 1864340 - Convert autocomplete footer strings to FTL, part {index}."""
+
+ propertiesSource = "browser/extensions/formautofill/formautofill.properties"
+ fluentSource = "browser/browser/preferences/formAutofill.ftl"
+ target = "toolkit/toolkit/formautofill/formAutofill.ftl"
+ ctx.add_transforms(
+ target,
+ target,
+ [
+ FTL.Message(
+ id=FTL.Identifier("autofill-manage-addresses-label"),
+ value=COPY(propertiesSource, "autocompleteManageAddresses"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-amex"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-amex"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-cartebancaire"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-cartebancaire"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-diners"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-diners"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-discover"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-discover"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-jcb"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-jcb"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-mastercard"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-mastercard"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-mir"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-mir"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-unionpay"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-unionpay"),
+ ),
+ FTL.Message(
+ id=FTL.Identifier("autofill-card-network-visa"),
+ value=COPY_PATTERN(fluentSource, "autofill-card-network-visa"),
+ ),
+ ],
+ )
diff --git a/python/l10n/fluent_migrations/bug_1864606_backlogged_crash_checkbox.py b/python/l10n/fluent_migrations/bug_1864606_backlogged_crash_checkbox.py
new file mode 100644
index 0000000000..e224b1b6fa
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1864606_backlogged_crash_checkbox.py
@@ -0,0 +1,41 @@
+# 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, COPY_PATTERN
+
+
+class STRIP_ANCHOR(TransformPattern):
+ # Used to remove `<a data-l10n-name="crash-reports-link">[...]</a>` from a string
+ def visit_TextElement(self, node):
+ node.value = re.sub(
+ ' *<a data-l10n-name="crash-reports-link">.*</a>', "", node.value
+ )
+ return node
+
+
+def migrate(ctx):
+ """Bug 1864606 - Standardize the backlogged crash reports checkbox implementation, part {index}."""
+ preferences_ftl = "browser/browser/preferences/preferences.ftl"
+ ctx.add_transforms(
+ preferences_ftl,
+ preferences_ftl,
+ [
+ FTL.Message(
+ id=FTL.Identifier("collection-backlogged-crash-reports"),
+ attributes=[
+ FTL.Attribute(
+ id=FTL.Identifier("accesskey"),
+ value=COPY_PATTERN(
+ preferences_ftl,
+ "collection-backlogged-crash-reports-with-link.accesskey",
+ ),
+ ),
+ ],
+ value=STRIP_ANCHOR(
+ preferences_ftl, "collection-backlogged-crash-reports-with-link"
+ ),
+ ),
+ ],
+ )
diff --git a/python/l10n/fluent_migrations/bug_1875957_web_appearance_warning.py b/python/l10n/fluent_migrations/bug_1875957_web_appearance_warning.py
new file mode 100644
index 0000000000..b07bcdf36e
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1875957_web_appearance_warning.py
@@ -0,0 +1,40 @@
+# 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_LINK(TransformPattern):
+ # Used to remove `<a data-l10n-name="colors-link">...</a>` from a string
+ def visit_TextElement(self, node):
+ node.value = re.sub(
+ '\s?<a data-l10n-name="colors-link">.+?</a>\s?',
+ "",
+ node.value,
+ )
+ return node
+
+
+def migrate(ctx):
+ """Bug 1875957 - Use moz-message-bar for web appearance warning, part {index}"""
+ preferences_ftl = "browser/browser/preferences/preferences.ftl"
+ ctx.add_transforms(
+ preferences_ftl,
+ preferences_ftl,
+ [
+ FTL.Message(
+ id=FTL.Identifier("preferences-web-appearance-override-warning2"),
+ attributes=[
+ FTL.Attribute(
+ id=FTL.Identifier("message"),
+ value=STRIP_LINK(
+ preferences_ftl,
+ "preferences-web-appearance-override-warning",
+ ),
+ ),
+ ],
+ ),
+ ],
+ )