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

Babel cannot find words in 3's f-Strings ? #210

Closed
teddy-lu opened this issue Dec 7, 2022 · 1 comment
Closed

Babel cannot find words in 3's f-Strings ? #210

teddy-lu opened this issue Dec 7, 2022 · 1 comment

Comments

@teddy-lu
Copy link

teddy-lu commented Dec 7, 2022

I have some words in 3's f-Strings sql code.
such as

s = f"""
SELECT * FROM aa
balabala ...
case bala...
{_("abc")}
WHERE b=1
"""

after I excute the order
$ pybabel extract -F babel.cfg -o messages.pot .

but I cannot find the words 'abc' from file messages.pot

@TkTech
Copy link
Contributor

TkTech commented Jan 14, 2023

The underlying Babel library does not support f-strings. You will need to raise an issue with them and/or add support in https://github.com/python-babel/babel/blob/master/babel/messages/extract.py#L581 to extract function usage inside a f-string AST node.

@TkTech TkTech closed this as completed Jan 14, 2023
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