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

help #25

Open
anewlearner256 opened this issue Dec 21, 2023 · 0 comments
Open

help #25

anewlearner256 opened this issue Dec 21, 2023 · 0 comments

Comments

@anewlearner256
Copy link

I have converted the .po to a .mo file, and then translated the .rst file through the following code, but the result is not translated, what is the reason? The following is the code converted by python:
`import gettext
import os

localedir = os.path.abspath("E:\worksp\Godot3.4\godot-docs\po\zh-CN")
lang = 'zh_CN'
_ = gettext.translation('godot-engine-godot-docs-zh_Hans', localedir, languages=[lang], fallback=False).gettext

with open("E:\worksp\Godot3.4\godot-docs\test.rst", 'r', encoding='utf-8') as rst_file:
str_to_translate = _(rst_file.read())

translated_content = _(str_to_translate)
print(translated_content)
`

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

1 participant