Open Bug 1611128 Opened 4 years ago Updated 4 years ago

Fluent migration fails to migrate } character correctly

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: flod, Unassigned)

References

Details

Source:

picture-in-picture-toggle-shortcut-alt =
    .key = {"}"}

Migration recipe:

picture-in-picture-toggle-shortcut-alt =
    .key = { COPY(browser_path, "togglePictureInPicture.key2") }

Results in broken FTL, where the curly parenthesis is not escaped.

picture-in-picture-toggle-shortcut-alt =
    .key = }

I guess the right place to fix that is in Transform.pattern_of.

I've been looking at this, and I'd be thinking of adding a NodeTransformer at the very start of pattern_of, which would handle both illegal text and illegal string literals. Not sure if we can do much about possibly illegal number literals, but I also don't know how we'd create those right now.

What bothers me about this approach is that we call pattern_of very aggressively. In

FTL.Message(
      id=FTL.Identifier("containers-disable-alert-ok-button"),
      value=PLURALS(
          "browser/chrome/browser/preferences/preferences.properties",
          "disableContainersOkButton",
          VARIABLE_REFERENCE("tabCount"),
          lambda text: REPLACE_IN_TEXT(
              text,
              {
                  "#1": VARIABLE_REFERENCE("tabCount")
              }
          )
      )
  )

we'd call it in variable reference each time, in replace text, in plurals. At least, I guess.

That shouldn't be a technical problem, but I'm concerned about flod's battery ;-)

stas?

You need to log in before you can comment on or make changes to this bug.