Page MenuHomePhabricator

Format specifier translation tests should be more accurate
Closed, DeclinedPublic

Description

Description

The existing translation tests check that translated strings have the same number of format specifiers as the default strings. This frequently causes false positives whenever an existing string is modified to include format specifiers.

This card covers the work to make the existing tests be more precise. That is, translations strings must have no format specifiers OR the same number of format specifiers as the default string. If format strings specify more format specifiers than the default, the Java code won't pass it. If they specify fewer, they're likely to be passed incorrect data which can also cause errors. An additional improvement would be to ensure each format specifier matches that in the default string.

There seems to be some support for this in Android Lint as "StringFormatMatches: String.format string doesn't match the XML format string". Maybe these Java tests can be removed?

Event Timeline

Niedzielski raised the priority of this task from to Medium.
Niedzielski updated the task description. (Show Details)
Niedzielski added subscribers: Niedzielski, bearND.

@hashar, I think this guy can be closed too. We worked around T110243 for now and I think T107336 is resolved.

Thus T62720: Jenkins should run tests for the Wikipedia app before merge is more being blocked and I marked it as resolved.

The Lint route looks very promising. I'm glad Lint covers this now.