Created
March 25, 2019 15:38
-
-
Save KwanEsq/2e5bd7ae094130c4403c4b691d6e6502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!ENTITY fill.label "Fill"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fill = | |
.label = | |
{ PLATFORM() -> | |
[linux] Zoom | |
*[windows] Fill | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf8 | |
from __future__ import absolute_import | |
import fluent.syntax.ast as FTL | |
from fluent.migrate.helpers import transforms_from | |
from fluent.migrate import COPY | |
def migrate(ctx): | |
"""Bug 123456 - Blah, part {index}.""" | |
ctx.add_transforms( | |
"fluent.ftl", | |
"fluent.ftl", | |
transforms_from( | |
""" | |
fill = | |
.label = { COPY(from_path, "fill.label") } | |
""", from_path="entities.dtd") | |
) | |
ctx.add_transforms( | |
"fluent.ftl", | |
"fluent.ftl", | |
[ | |
FTL.Message( | |
id=FTL.Identifier('fill'), | |
attributes=[ | |
FTL.Attribute( | |
FTL.Identifier('label'), | |
FTL.Pattern( | |
elements=[ | |
FTL.Placeable( | |
expression=FTL.SelectExpression( | |
expression=FTL.CallExpression( | |
callee=FTL.Function('PLATFORM') | |
), | |
variants=[ | |
FTL.Variant( | |
key=FTL.VariantName('linux'), | |
default=False, | |
value='' | |
), | |
FTL.Variant( | |
key=FTL.VariantName('windows'), | |
default=True, | |
value=COPY( | |
'entities.dtd', | |
'fill.label' | |
) | |
) | |
] | |
) | |
) | |
] | |
) | |
) | |
] | |
) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment