Bug 1460806 - Clean up Fluent migration recipes r=gandalf

MozReview-Commit-ID: 8hODnvJc4Qc

--HG--
extra : rebase_source : 641019353402900bea7985650bdf2b2133d4c754
This commit is contained in:
Francesco Lodolo (:flod) 2018-05-11 08:12:52 +02:00
parent 59fbde2fb7
commit e30cbdf2d8
19 changed files with 128 additions and 286 deletions

View File

@ -7,7 +7,6 @@ from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE, EXTERNAL_ARGUMENT
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate.transforms import PLURALS, REPLACE_IN_TEXT
def migrate(ctx):
@ -247,41 +246,6 @@ def migrate(ctx):
),
],
),
FTL.Message(
id=FTL.Identifier('containers-remove-alert-title'),
value=COPY(
'browser/chrome/browser/preferences/preferences.properties',
'removeContainerAlertTitle',
),
),
FTL.Message(
id=FTL.Identifier('containers-remove-alert-msg'),
value=PLURALS(
'browser/chrome/browser/preferences/preferences.properties',
'removeContainerMsg',
EXTERNAL_ARGUMENT('count'),
lambda text: REPLACE_IN_TEXT(
text,
{
'#S': EXTERNAL_ARGUMENT('count')
}
)
)
),
FTL.Message(
id=FTL.Identifier('containers-remove-ok-button'),
value=COPY(
'browser/chrome/browser/preferences/preferences.properties',
'removeContainerOkButton',
),
),
FTL.Message(
id=FTL.Identifier('containers-remove-cancel-button'),
value=COPY(
'browser/chrome/browser/preferences/preferences.properties',
'removeContainerButton2',
),
),
FTL.Message(
id=FTL.Identifier('containers-color-blue'),
attributes=[

View File

@ -5,9 +5,8 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE, EXTERNAL_ARGUMENT
from fluent.migrate.transforms import REPLACE
from fluent.migrate import COPY, CONCAT
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
def migrate(ctx):
@ -27,7 +26,7 @@ def migrate(ctx):
FTL.Placeable(
expression=FTL.SelectExpression(
expression=FTL.CallExpression(
callee=FTL.Identifier('PLATFORM')
callee=FTL.Function('PLATFORM')
),
variants=[
FTL.Variant(

View File

@ -712,7 +712,7 @@ def migrate(ctx):
FTL.Placeable(
expression=FTL.SelectExpression(
expression=FTL.CallExpression(
callee=FTL.Identifier('PLATFORM')
callee=FTL.Function('PLATFORM')
),
variants=[
FTL.Variant(
@ -744,7 +744,7 @@ def migrate(ctx):
FTL.Placeable(
expression=FTL.SelectExpression(
expression=FTL.CallExpression(
callee=FTL.Identifier('PLATFORM')
callee=FTL.Function('PLATFORM')
),
variants=[
FTL.Variant(

View File

@ -6,7 +6,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE, EXTERNAL_ARGUMENT
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import CONCAT, REPLACE
def migrate(ctx):

View File

@ -1,128 +0,0 @@
# coding=utf8
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE, EXTERNAL_ARGUMENT
from fluent.migrate import COPY, CONCAT, REPLACE
def migrate(ctx):
"""Bug 1445084 - Migrate search results pane of Preferences to Fluent, part {index}."""
ctx.add_transforms(
'browser/browser/preferences/preferences.ftl',
'browser/browser/preferences/preferences.ftl',
[
FTL.Message(
id=FTL.Identifier('search-input-box'),
attributes=[
FTL.Attribute(
FTL.Identifier('style'),
CONCAT(
FTL.TextElement('width: '),
COPY(
'browser/chrome/browser/preferences/preferences.dtd',
'searchField.width'
)
),
),
FTL.Attribute(
FTL.Identifier('placeholder'),
FTL.Pattern([
FTL.Placeable(FTL.SelectExpression(
expression=FTL.CallExpression(
callee=FTL.Identifier('PLATFORM')
),
variants=[
FTL.Variant(
key=FTL.VariantName('windows'),
default=False,
value=COPY(
'browser/chrome/browser/preferences/preferences.properties',
'searchInput.labelWin'
)
),
FTL.Variant(
key=FTL.VariantName('other'),
default=True,
value=COPY(
'browser/chrome/browser/preferences/preferences.properties',
'searchInput.labelUnix'
)
)
]
))
])
),
]
),
FTL.Message(
id=FTL.Identifier('search-results-header'),
value=COPY(
'browser/chrome/browser/preferences/preferences.dtd',
'paneSearchResults.title'
)
),
FTL.Message(
id=FTL.Identifier('search-results-sorry-message'),
value=FTL.Pattern(
elements=[
FTL.Placeable(
expression=FTL.SelectExpression(
expression=FTL.CallExpression(
callee=FTL.Identifier('PLATFORM')
),
variants=[
FTL.Variant(
key=FTL.VariantName('windows'),
default=False,
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'searchResults.sorryMessageWin',
{
'%S': FTL.TextElement("<span></span>")
},
)
),
FTL.Variant(
key=FTL.VariantName('other'),
default=True,
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'searchResults.sorryMessageUnix',
{
'%S': FTL.TextElement("<span></span>")
},
)
)
]
)
)
]
),
),
FTL.Message(
id=FTL.Identifier('search-results-need-help'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'searchResults.needHelp3',
{
'%S': CONCAT(
FTL.TextElement('<a>'),
REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'searchResults.needHelpSupportLink',
{
'%S': MESSAGE_REFERENCE('-brand-short-name'),
},
),
FTL.TextElement('</a>'),
),
},
),
),
]
)

View File

@ -0,0 +1,69 @@
# coding=utf8
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1445084 - Migrate search results pane of Preferences to Fluent, part {index}."""
ctx.add_transforms(
'browser/browser/preferences/preferences.ftl',
'browser/browser/preferences/preferences.ftl',
[
FTL.Message(
id=FTL.Identifier('search-input-box'),
attributes=[
FTL.Attribute(
FTL.Identifier('style'),
CONCAT(
FTL.TextElement('width: '),
COPY(
'browser/chrome/browser/preferences/preferences.dtd',
'searchField.width'
)
),
),
FTL.Attribute(
FTL.Identifier('placeholder'),
FTL.Pattern([
FTL.Placeable(FTL.SelectExpression(
expression=FTL.CallExpression(
callee=FTL.Function('PLATFORM')
),
variants=[
FTL.Variant(
key=FTL.VariantName('windows'),
default=False,
value=COPY(
'browser/chrome/browser/preferences/preferences.properties',
'searchInput.labelWin'
)
),
FTL.Variant(
key=FTL.VariantName('other'),
default=True,
value=COPY(
'browser/chrome/browser/preferences/preferences.properties',
'searchInput.labelUnix'
)
)
]
))
])
),
]
),
FTL.Message(
id=FTL.Identifier('search-results-header'),
value=COPY(
'browser/chrome/browser/preferences/preferences.dtd',
'paneSearchResults.title'
)
),
]
)

View File

@ -428,7 +428,7 @@ def migrate(ctx):
FTL.Pattern([
FTL.Placeable(FTL.SelectExpression(
expression=FTL.CallExpression(
callee=FTL.Identifier('PLATFORM')
callee=FTL.Function('PLATFORM')
),
variants=[
FTL.Variant(

View File

@ -7,7 +7,7 @@ from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate.transforms import REPLACE
from fluent.migrate import COPY, CONCAT
from fluent.migrate import COPY
def migrate(ctx):
@ -45,25 +45,6 @@ def migrate(ctx):
'formsAndPasswords.label',
),
),
FTL.Message(
id=FTL.Identifier('forms-remember-logins'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/security.dtd',
'rememberLogins2.label',
),
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/security.dtd',
'rememberLogins2.accesskey',
),
),
],
),
FTL.Message(
id=FTL.Identifier('forms-exceptions'),
attributes=[
@ -546,21 +527,6 @@ def migrate(ctx):
'trackingProtectionHeader2.label',
),
),
FTL.Message(
id=FTL.Identifier('tracking-description'),
value=CONCAT(
COPY(
'browser/chrome/browser/preferences/privacy.dtd',
'trackingProtection3.description',
),
FTL.TextElement(' <a>'),
COPY(
'browser/chrome/browser/preferences/privacy.dtd',
'trackingProtectionLearnMore2.label',
),
FTL.TextElement('</a>'),
),
),
FTL.Message(
id=FTL.Identifier('tracking-mode-label'),
value=COPY(

View File

@ -22,8 +22,8 @@ def migrate(ctx):
FTL.Identifier('title'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'window.title',
),
'window.title'
)
),
FTL.Attribute(
FTL.Identifier('style'),
@ -31,11 +31,11 @@ def migrate(ctx):
FTL.TextElement('width: '),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'window.width',
),
'window.width'
)
)
),
],
)
]
),
FTL.Message(
id=FTL.Identifier('clear-site-data-description'),
@ -44,8 +44,8 @@ def migrate(ctx):
'window.description',
{
'&brandShortName;': MESSAGE_REFERENCE('-brand-short-name')
},
),
}
)
),
FTL.Message(
id=FTL.Identifier('clear-site-data-close-key'),
@ -54,56 +54,24 @@ def migrate(ctx):
FTL.Identifier('key'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'windowClose.key',
),
),
],
),
FTL.Message(
id=FTL.Identifier('clear-site-data-cookies'),
value=COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'clearSiteData.label',
),
attributes=[
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'clearSiteData.accesskey',
),
),
],
'windowClose.key'
)
)
]
),
FTL.Message(
id=FTL.Identifier('clear-site-data-cookies-info'),
value=COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'clearSiteData.description',
),
),
FTL.Message(
id=FTL.Identifier('clear-site-data-cache'),
value=COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'clearCache.label',
),
attributes=[
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'clearCache.accesskey',
),
),
],
'clearSiteData.description'
)
),
FTL.Message(
id=FTL.Identifier('clear-site-data-cache-info'),
value=COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'clearCache.description',
),
'clearCache.description'
)
),
FTL.Message(
id=FTL.Identifier('clear-site-data-cancel'),
@ -112,17 +80,17 @@ def migrate(ctx):
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'button.cancel.label',
),
'button.cancel.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'button.cancel.accesskey',
),
),
],
'button.cancel.accesskey'
)
)
]
),
FTL.Message(
id=FTL.Identifier('clear-site-data-clear'),
@ -131,17 +99,17 @@ def migrate(ctx):
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'button.clear.label',
),
'button.clear.label'
)
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/clearSiteData.dtd',
'button.clear.accesskey',
),
),
],
),
'button.clear.accesskey'
)
)
]
)
]
)

View File

@ -5,8 +5,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Colors to Fluent, part {index}."""

View File

@ -5,8 +5,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Connection to Fluent, part {index}."""

View File

@ -5,8 +5,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Fonts to Fluent, part {index}."""

View File

@ -5,8 +5,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Languages to Fluent, part {index}."""

View File

@ -5,8 +5,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Permissions to Fluent, part {index}."""

View File

@ -5,8 +5,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Select Bookmark to Fluent, part {index}."""

View File

@ -6,7 +6,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Site Data to Fluent, part {index}."""

View File

@ -5,8 +5,7 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate import COPY, CONCAT, REPLACE
from fluent.migrate import COPY, CONCAT
def migrate(ctx):
"""Bug 1451992 - Migrate Preferences::Subdialogs::Translation to Fluent, part {index}."""

View File

@ -115,7 +115,6 @@ sitedata-total-size-calculating = { COPY("browser/chrome/browser/preferences/pre
'browser/browser/preferences/siteDataSettings.ftl',
transforms_from(
"""
site-usage-persistent = { site-usage-pattern } (Persistent)
site-data-remove-all =
.label = { COPY("browser/chrome/browser/preferences/preferences.properties", "removeAllSiteData.label") }
.accesskey = { COPY("browser/chrome/browser/preferences/preferences.properties", "removeAllSiteData.accesskey") }
@ -127,6 +126,20 @@ site-data-removing-dialog =
.buttonlabelaccept = { COPY("browser/chrome/browser/preferences/preferences.properties", "acceptRemove") }
""") + [
# This replacement might not always work, since locales can either
# remove the space, or use a non-breaking space for "%1$S %2$S"
FTL.Message(
id=FTL.Identifier('site-usage-persistent'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'siteUsagePersistent',
{
'%1$S %2$S': MESSAGE_REFERENCE(
'site-usage-pattern'
)
}
)
),
FTL.Message(
id=FTL.Identifier('site-data-settings-description'),
value=REPLACE(

View File

@ -6,8 +6,6 @@
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate.helpers import transforms_from
# from fluent.migrate.helpers import MESSAGE_REFERENCE, EXTERNAL_ARGUMENT, transforms_from
# from fluent.migrate import COPY, CONCAT, REPLACE
def migrate(ctx):