Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @dp.message_handler(lambda m: m.from_user.id in admins, content_types=['document'])
- async def change_localization(m):
- name = m.document.file_name
- if name == 'ru_RU.po':
- f = await bot.get_file(m.document.file_id)
- print(f)
- print(f'https://api.telegram.org/file/bot{API_TOKEN}{f.file_path}')
- r = requests.get(f'https://api.telegram.org/file/bot{API_TOKEN}/{f.file_path}')
- print(r)
- print(r.content)
- with open('./locale/ru/LC_MESSAGES/ru_RU.po', 'wb') as file:
- file.write(r.content)
- print('Ready')
- print(os.path.abspath("./locale/ru/LC_MESSAGES/ru_RU.po"))
- Popen(["python", "C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37-32\\Tools\\i18n\\msgfmt.py", "./locale/ru/LC_MESSAGES/ru_RU.po"],
- stdout=sys.stdout).communicate()
- gettext.install('ru_RU', './locale')
- print('Good to go')
- #еще пробовал так:
- gettext_windows.setup_env()
- locale.setlocale(locale.LC_ALL, '')
- gettext.install('ru_RU', './locale')
- #и так:
- t = gettext.translation('ru_Ru', './locale')
- global _
- _ = t.gettext
- #и еще так:
- os.execle(sys.executable, sys.executable, *sys.argv)
Add Comment
Please, Sign In to add comment