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

Abnormal translation when I place non-string in parameters #231

Open
Muzych opened this issue May 29, 2023 · 2 comments
Open

Abnormal translation when I place non-string in parameters #231

Muzych opened this issue May 29, 2023 · 2 comments

Comments

@Muzych
Copy link

Muzych commented May 29, 2023

Here is our scene, we give a code to infer Chinese translations and English translations.
For example , the number 10157 would infer to a SPACE between two words.
When I use ('10157') in my code such as "Hello('10157')World", the result in English could be "Hello World" and "你好" in Chinese.
But what I really have in output is the msgid of SPACE separator. It seems like "你10157好".
I would like to know whether the flask-babel support non-string in parameters and why I get the msgid when I place non-string in parameters like this _('').

@TkTech
Copy link
Contributor

TkTech commented May 29, 2023

Can you provide a code example? I'm having trouble understanding what you're trying to accomplish.

@Muzych
Copy link
Author

Muzych commented May 31, 2023

Ok. Here's an example.

{
    "10157": {"en": " ", "zh": ""}
}

print("你" + _("10157") + "好")

What I expect to get:
Chinese:  你好
English: 你 好

What I actually get:
Chinese: 你10157好
English: 你 好

In short, it seems like flask-babel translate null string to msgid.

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