Closed Bug 1491833 Opened 6 years ago Closed 6 years ago

Create helper to normalize indention for DTDs, or tweak COPY to do so

Categories

(Localization Infrastructure and Tools :: Fluent Migration, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Pike, Assigned: Pike)

References

Details

Attachments

(1 file)

We have DTD entries that format their multi-line values in ways that makes them unfortunate to migrate.

We should normalize their values to match fluent's expectations.

We can do this with an explicit transform NORMALIZE_INDENT, or make that implicitly the default for COPY().

Explicit is nice, but it's also easy to forget. Implicit is magic, but maybe that's OK?

Use-cases are bugs 1486934, 1491738.

def migrate(ctx):
    """Bug 1486934 - Modify about:about to use fluent for localization, part {index}."""

    ctx.add_transforms(
        "toolkit/toolkit/about/aboutAbout.ftl",
        "toolkit/toolkit/about/aboutAbout.ftl",
        transforms_from(
"""
about-about-title = { COPY("toolkit/chrome/global/aboutAbout.dtd", "aboutAbout.title") }
about-about-note = { COPY("toolkit/chrome/global/aboutAbout.dtd", "aboutAbout.note") }
""")
)


Note, .properties are not affected, the few multi-line strings I found there are not indenting, neither in l10n nor in en-US. Also, not happening in Firefox outside of a single devtools string.

stas, flod, opinions?
Flags: needinfo?(francesco.lodolo)
I think I prefer the explicit transform (e.g. COPY_NORMALIZED).

Experience tells me that localizers follow the source, and do weird indentation only when the source has it. One more reason for that option is that we would need it only for DTDs, and few strings spanning multiple lines.
Flags: needinfo?(francesco.lodolo)
Started to work on NORMALIZED_COPY. Wrapping COPY is hard, so this is a new top-level transform.
Assignee: nobody → l10n
NORMALIZED_COPY normalizes white-space, and is intended to be
used when converting multi-line DTD entries to Fluent.
Blocks: 1492070
Comment on attachment 9009882 [details]
bug 1491833, add TRIM_COPY to transforms, r=stas

Staś Małolepszy :stas has approved the revision.
Attachment #9009882 - Flags: review+
Attachment #9009882 - Attachment description: bug 1491833, add NORMALIZED_COPY to transforms, r=stas → bug 1491833, add TRIM_COPY to transforms, r=stas
https://hg.mozilla.org/l10n/fluent-migration/rev/021e74318ed8 landed, marking FIXED.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
follow-up fix 'cause this didn't work in practice just yet:

https://hg.mozilla.org/l10n/fluent-migration/rev/6f2a92caae2a959d2ddf0700269b3686653500f3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: