Closed Bug 1630407 Opened 5 years ago Closed 5 years ago

Error message "Expected a character from range: "a-zA-Z" is hard to understand

Categories

(Webtools Graveyard :: Pontoon, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1584178

People

(Reporter: lasse.liehu, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0

Steps to reproduce:

(Marked version as "other" because could not determine which version of Pontoon was running at pontoon.mozilla.org at the time of writing this.)

Received a message from another translator who said they have started to receive this "mysterious error" again and again. Steps to reproduce:

  1. Open https://pontoon.mozilla.org/fi/lightning/calendar/calendar/calendar-uri-redirect-dialog.ftl/?string=209313 – This string has a placeholder "{ $calendarName }". (Any string with a similar placeholder probably works. See below.)
  2. Copy machinery suggestion from Google Translation and try to save it as a suggestion. This suggestion contains the placeholder in form "{$ calendarName}". Note how there is an erroneous space between the dollar sign and name.

Actual results:

Received the following error: Expected a character from range: "a-zA-Z"

A translator who contacted me did not understand why this error happened and thus asked for help.

Expected results:

It would have been nice and would probably have saved a translator some time if the error message was clearer that the cause was the erroneous space between the dollar sign and name in the placeholder.

Summary: Error message "Expected a character from range: "a-zA-Z"" is hard to understand → Error message "Expected a character from range: "a-zA-Z" is hard to understand

Thanks for the report, Lasse!

The error message comes from the Fluent parser, which fails to parse the message.

:stas, I wonder how much flexibility do we have in making this error message easier to understand?
https://github.com/projectfluent/python-fluent/blob/ec43f38ea5e6811410ce609921f0237f690d352f/fluent.syntax/fluent/syntax/errors.py#L19

Another solution to the problem is tracked under bug 1584178.

Flags: needinfo?(stas)

Error annotation in bug 1581911 also seems quite helpful if that helps to see the exact position where the error occurred.

The error messages built into fluent.syntax could use some rewording for sure. But I think that since they're produced directly by the parser, it might be impossible to ensure they are phrased in a way which caters to every possible audience. So perhaps the best way forward is to keep them succint and "dry".

For this use-case, I think the alternative would be to check the error.code and use the array of error.args to build custom error messages. This would allow tailoring the wording to the expect audience (translators), as well as localizing them in the future, too.

Flags: needinfo?(stas)

FWIW, the ' ' in placeables is most frequently added by google translate, and I love to figure out how to prevent that to begin with much more than trying to recover from it gracefully.

See Also: → 1630979

Thanks for the updates, everybody!

I agree the proper solution here is to fix bug 1584178 and bug 1630979.

Resetting severity to default of --.

Marking as dupe of bug 1584178, which is the root cause here.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.