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

BadFormatLintRule looks at tokens inside other formatting tokens which it shouldn't do #72

Closed
NotSqrt opened this issue Oct 7, 2015 · 5 comments

Comments

@NotSqrt
Copy link

NotSqrt commented Oct 7, 2015

Hi,

If I have things like "{start:%Y-%m-%d %H:%M}", I think YMHm should be considered valid.

Thanks !

@willkg
Copy link
Member

willkg commented Oct 7, 2015

I don't understand what you mean by this. Can you copy/paste a complete example? See #63 as an example.

@NotSqrt
Copy link
Author

NotSqrt commented Oct 7, 2015

An example:

#, python-brace-format
msgid "No data between {start:%Y-%m-%d %H:%M} and {end:%Y-%m-%d %H:%M}"
msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"
_("No data between {start:%Y-%m-%d %H:%M} and {end:%Y-%m-%d %H:%M}").format(start=date1, end=date2)

@willkg
Copy link
Member

willkg commented Oct 13, 2015

I tossed this into a test .po file and got this output:

E104: bad format character: %Y
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

E104: bad format character: %m
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

E104: bad format character: %H
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

E104: bad format character: %M
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

E104: bad format character: %Y
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

E104: bad format character: %m
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

E104: bad format character: %H
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

E104: bad format character: %M
0:msgstr "Pas de données entre le {start:%Y-%m-%d %H:%M} et le {end:%Y-%m-%d %H:%M}"

The BadFormatLintRule shouldn't be looking at formatting tokens inside of other formatting tokens. I'll have to think about this.

@willkg willkg changed the title Bad format: date formatting should be allowed ? BadFormatLintRule looks at tokens inside other formatting tokens which it shouldn't do Oct 13, 2015
@willkg willkg closed this as completed in bce6308 Oct 13, 2015
@willkg
Copy link
Member

willkg commented Oct 13, 2015

That fixes this specific issue and should fix the general problem, too. In working on this, I found another problem with translators that requires a minor rewrite. That's covered in #67. I need to fix that before I do another release.

@NotSqrt
Copy link
Author

NotSqrt commented Oct 14, 2015

Thanks @willkg !

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

No branches or pull requests

2 participants