Source code
Revision control
Copy as Markdown
Other Tools
# Any copyright is dedicated to the Public Domain.
import re
import fluent.syntax.ast as FTL
from fluent.migrate.transforms import LegacySource, Transform, normalize_printf
class STRIP_LEARN_MORE(LegacySource):
def __call__(self, ctx):
element = super().__call__(ctx)
value = re.sub(r"\s*%1\$S", "", normalize_printf(element.value))
value = re.sub(r" {2,}", " ", value).strip()
return Transform.pattern_of(FTL.TextElement(value))
def migrate(ctx):
source = "toolkit/chrome/passwordmgr/passwordmgr.properties"
target = "toolkit/toolkit/main-window/autocomplete.ftl"
ctx.add_transforms(
target,
target,
[
FTL.Message(
id=FTL.Identifier("autocomplete-insecure-login-warning"),
value=STRIP_LEARN_MORE(source, "insecureFieldWarningDescription2"),
),
],
)