Python sanic babel的翻译

Python sanic babel的翻译,python,python-babel,Python,Python Babel,我用Sanic Babel在Sanic应用程序中进行了本地化,我想将现有的翻译迁移到json,我可以获得原始文本,但无法获得翻译,应用程序运行良好,当请求到来时它会进行翻译,但在迁移过程中我没有请求。我查了babel.list_的翻译我有“ru”和“en”。我必须得到“ru”版本的翻译文本。 我试过强迫你 with force_locale('ru'): for title in localization.ANCILLARY_TITLES.values(): print(gettex

我用Sanic Babel在Sanic应用程序中进行了本地化,我想将现有的翻译迁移到json,我可以获得原始文本,但无法获得翻译,应用程序运行良好,当请求到来时它会进行翻译,但在迁移过程中我没有请求。我查了babel.list_的翻译我有“ru”和“en”。我必须得到“ru”版本的翻译文本。 我试过强迫你

with force_locale('ru'):
  for title in localization.ANCILLARY_TITLES.values():
    print(gettext(title))
但在这里,他只是用英文打印原文