bug_1971841_sync_settings_redesign.py (3309B)
1 # Any copyright is dedicated to the Public Domain. 2 # http://creativecommons.org/publicdomain/zero/1.0/ 3 4 import re 5 from fluent.migrate.transforms import TransformPattern, COPY_PATTERN 6 import fluent.syntax.ast as FTL 7 8 9 class STRIP_ELLIPSIS(TransformPattern): 10 def visit_TextElement(self, node): 11 node.value = re.sub(r"(?:…|\.\.\.)$", "", node.value) 12 return node 13 14 15 def migrate(ctx): 16 """Bug 1971841 - Convert Sync section to config-based prefs, part {index}""" 17 18 path = "browser/browser/preferences/preferences.ftl" 19 20 ctx.add_transforms( 21 path, 22 path, 23 [ 24 FTL.Message( 25 id=FTL.Identifier("sync-group-label"), 26 attributes=[ 27 FTL.Attribute( 28 id=FTL.Identifier("label"), 29 value=COPY_PATTERN(path, "pane-sync-title3"), 30 ), 31 ], 32 ), 33 FTL.Message( 34 id=FTL.Identifier("prefs-sync-turn-on-syncing-2"), 35 attributes=[ 36 FTL.Attribute( 37 id=FTL.Identifier("label"), 38 value=STRIP_ELLIPSIS(path, "prefs-sync-turn-on-syncing.label"), 39 ), 40 FTL.Attribute( 41 id=FTL.Identifier("accesskey"), 42 value=COPY_PATTERN( 43 path, "prefs-sync-turn-on-syncing.accesskey" 44 ), 45 ), 46 ], 47 ), 48 FTL.Message( 49 id=FTL.Identifier("prefs-sync-now-button-2"), 50 attributes=[ 51 FTL.Attribute( 52 id=FTL.Identifier("label"), 53 value=COPY_PATTERN(path, "prefs-sync-now-button.label"), 54 ), 55 FTL.Attribute( 56 id=FTL.Identifier("accesskey"), 57 value=COPY_PATTERN(path, "prefs-sync-now-button.accesskey"), 58 ), 59 ], 60 ), 61 FTL.Message( 62 id=FTL.Identifier("prefs-syncing-button-2"), 63 attributes=[ 64 FTL.Attribute( 65 id=FTL.Identifier("label"), 66 value=COPY_PATTERN(path, "prefs-syncing-button.label"), 67 ), 68 FTL.Attribute( 69 id=FTL.Identifier("title"), 70 value=COPY_PATTERN(path, "prefs-sync-now-button.label"), 71 ), 72 ], 73 ), 74 FTL.Message( 75 id=FTL.Identifier("sync-device-name-header-2"), 76 attributes=[ 77 FTL.Attribute( 78 id=FTL.Identifier("label"), 79 value=COPY_PATTERN(path, "sync-device-name-header"), 80 ), 81 ], 82 ), 83 FTL.Message( 84 id=FTL.Identifier("sync-connect-another-device-2"), 85 attributes=[ 86 FTL.Attribute( 87 id=FTL.Identifier("label"), 88 value=COPY_PATTERN(path, "sync-connect-another-device"), 89 ), 90 ], 91 ), 92 ], 93 )