Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive in FormattingPlaceable #3368

Open
mathjazz opened this issue Nov 23, 2015 · 3 comments · May be fixed by #3414
Open

False positive in FormattingPlaceable #3368

mathjazz opened this issue Nov 23, 2015 · 3 comments · May be fixed by #3414
Assignees
Labels
Milestone

Comments

@mathjazz
Copy link

In the following example, "% s" is detected as a placeable:
"xx% support a Web" -> "xx% support a Web"

The regex should be able to detect the whitespace between % and s and abort.

More specifically, the bug is probably in:
https://github.com/translate/translate/blob/master/translate/storage/placeables/general.py#L150

@dwaynebailey
Copy link
Member

This class handles sprintf, a space here is perfectly valid according to sprintf. Likely you don't want to use that type of placeable in a context that isn't using printf style C variables.

Correctly space is only valid if the conversion specifier is in (a, A, d, e, E, f, F, g, G, or i). So that could be an improvement to prevent that being detected.

Patches gladly accepted.

@phlax phlax added this to the 2.0 milestone Mar 16, 2016
@phlax phlax added the mozilla label Mar 16, 2016
@unho
Copy link
Member

unho commented Mar 16, 2016

Perhaps addressed in PR #3375

@unho
Copy link
Member

unho commented Mar 30, 2016

No, not addressed in #3375 since that is about checks, not placeables.

@unho unho self-assigned this Mar 30, 2016
unho added a commit to unho/translate that referenced this issue Mar 30, 2016
This fix prevents from detecting strings like "% s" to be format placeholders.

Fixes translate#3368.
@unho unho linked a pull request Mar 30, 2016 that will close this issue
unho added a commit to unho/translate that referenced this issue Mar 30, 2016
This fix prevents from detecting strings like "% s" to be format placeholders.

Fixes translate#3368.
unho added a commit to unho/translate that referenced this issue Mar 30, 2016
This fix prevents from detecting strings like "% s" to be format placeholders.

Fixes translate#3368.
@unho unho removed this from the 2.0 milestone Apr 7, 2016
@unho unho modified the milestone: 2.0.1 Feb 7, 2017
unho added a commit to unho/translate that referenced this issue Sep 4, 2017
This fix prevents from detecting strings like "% s" to be format placeholders.

Fixes translate#3368.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants