[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2020-11-09 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10 -Python 3.7 ___ Python tracker ___

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2020-11-09 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: New changeset bfc6b63102d37ccb58a71711e2342143cd9f4d86 by jack1142 in branch 'master': bpo-36310: Allow pygettext.py to detect calls to gettext in f-strings. (GH-19875) https://github.com/python/cpython/commit/bfc6b63102d37ccb58a71711e2342143cd9f4d86

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2020-05-02 Thread jack1142
Change by jack1142 : -- keywords: +patch pull_requests: +19186 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19875 ___ Python tracker ___

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2020-05-01 Thread jack1142
Change by jack1142 : -- nosy: +jack1142 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-07-24 Thread Eric V. Smith
Eric V. Smith added the comment: I've put some more thought in to this, and this is the best I can come up with, using today's Python. The basic idea is that you have a function _f(), which takes a normal (non-f) string. It does a lookup to find the translated string (again, a non-fstring),

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Eric V. Smith
Eric V. Smith added the comment: Of course, this wouldn't be any safer than eval'ing arbitrary user provided code. -- ___ Python tracker ___

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Eric V. Smith
Eric V. Smith added the comment: I was going to say "use eval()", but maybe we need some sort of "eval_fstring()" that basically only understood f-strings and produced a callable that captured all of the variables (like a closure), maybe that would help. --

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Allie Fitter
Allie Fitter added the comment: Just as context, my use case for this is interpolating translated strings into HTML. html = f'''\ {_("Some Title")} {_("Some longer text")} ''' -- ___ Python tracker

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks for adding me, Toshio. foo = f'{_(f"{first}, bar, and {last}")}' Wow, that's extremely creative. I agree that this isn't the best we can do. PEP 501 has some ideas, but it might be too general purpose and powerful for this. Let me think about the

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-05-09 Thread Toshio Kuratomi
Toshio Kuratomi added the comment: Eric, I'm CC'ing you on this issue because I'm not sure if you've considered f-strings and gettext and figured out a way to make them work together. If you have, I can look into adding support for extracting the strings to pygettext but at the moment, I'm

[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2019-03-15 Thread Allie Fitter
New submission from Allie Fitter : pygettext can't see gettext functions calls when they're inside of an fstring: foo.py from gettext import gettext as _ foo = f'{_("foo bar baz")}' Running `pygettext3.7 -kgt -d message -D -v -o locales/message.pot foo.py` results in: