Verified Commit 721307c1 authored by henry's avatar henry Committed by ma1
Browse files

Tor Browser localization migration scripts.

parent 080c348f
Loading
Loading
Loading
Loading
+672 −0

File added.

Preview size limit exceeded, changes collapsed.

+0 −0

Empty file added.

+24 −0
Original line number Diff line number Diff line
from fluent.migrate.helpers import transforms_from


def migrate(ctx):
    ctx.add_transforms(
        "tor-browser.ftl",
        "tor-browser.ftl",
        transforms_from(
            """
menu-open-tor-manual =
    .label = { COPY(path, "aboutTor.torbrowser_user_manual.label") }
    .accesskey = { COPY(path, "aboutTor.torbrowser_user_manual.accesskey") }

tor-browser-home-heading-stable = { COPY(path, "aboutTor.ready.label") }
tor-browser-home-heading-testing = { COPY(path, "aboutTor.alpha.ready.label") }

tor-browser-home-duck-duck-go-input =
    .placeholder = { COPY(path, "aboutTor.search.label") }

tor-browser-home-message-introduction = { COPY(path, "aboutTor.ready2.label") }
""",
            path="aboutTor.dtd",
        ),
    )
+21 −0
Original line number Diff line number Diff line
from fluent.migrate.helpers import transforms_from


def migrate(ctx):
    ctx.add_transforms(
        "tor-browser.ftl",
        "tor-browser.ftl",
        transforms_from(
            """
onion-neterror-not-found-description = { COPY(path, "onionServices.descNotFound") }
onion-neterror-unreachable-description = { COPY(path, "onionServices.descInvalid") }
onion-neterror-disconnected-description = { COPY(path, "onionServices.introFailed") }
onion-neterror-connection-failed-description = { COPY(path, "onionServices.rendezvousFailed") }
onion-neterror-missing-authentication-description = { COPY(path, "onionServices.clientAuthMissing") }
onion-neterror-incorrect-authetication-description = { COPY(path, "onionServices.clientAuthIncorrect") }
onion-neterror-invalid-address-description = { COPY(path, "onionServices.badAddress") }
onion-neterror-timed-out-description = { COPY(path, "onionServices.introTimedOut") }
""",
            path="torbutton.properties",
        ),
    )
+34 −0
Original line number Diff line number Diff line
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import VARIABLE_REFERENCE, transforms_from
from fluent.migrate.transforms import REPLACE


def migrate(ctx):
    legacy_path = "cryptoSafetyPrompt.properties"

    ctx.add_transforms(
        "tor-browser.ftl",
        "tor-browser.ftl",
        transforms_from(
            """
crypto-safety-prompt-title = { COPY(path, "cryptoSafetyPrompt.cryptoTitle") }
crypto-safety-prompt-reload-button = { COPY(path, "cryptoSafetyPrompt.primaryAction") }
crypto-safety-prompt-dismiss-button = { COPY(path, "cryptoSafetyPrompt.secondaryAction") }
""",
            path=legacy_path,
        )
        + [
            # Replace "%1$S" and "%2$S" with "{ $address }" and "{ $host }"
            FTL.Message(
                id=FTL.Identifier("crypto-safety-prompt-body"),
                value=REPLACE(
                    legacy_path,
                    "cryptoSafetyPrompt.cryptoBody",
                    {
                        "%1$S": VARIABLE_REFERENCE("address"),
                        "%2$S": VARIABLE_REFERENCE("host"),
                    },
                ),
            ),
        ],
    )
Loading