telegram-bot-template: Localization error in docker (container: bot)

2024-04-06 22:01:45 bot            | Traceback (most recent call last):
2024-04-06 22:01:45 bot            |   File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
2024-04-06 22:01:45 bot            |     return _run_code(code, main_globals, None,
2024-04-06 22:01:45 bot            |   File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
2024-04-06 22:01:45 bot            |     exec(code, run_globals)
2024-04-06 22:01:45 bot            |   File "/usr/src/app/bot/__main__.py", line 10, in <module>
2024-04-06 22:01:45 bot            |     from bot.core.loader import app, bot, dp
2024-04-06 22:01:45 bot            |   File "/usr/src/app/bot/core/loader.py", line 32, in <module>
2024-04-06 22:01:45 bot            |     i18n: I18n = I18n(path=LOCALES_DIR, default_locale="en", domain=I18N_DOMAIN)
2024-04-06 22:01:45 bot            |   File "/usr/local/lib/python3.10/site-packages/aiogram/utils/i18n/core.py", line 24, in __init__
2024-04-06 22:01:45 bot            |     self.locales = self.find_locales()
2024-04-06 22:01:45 bot            |   File "/usr/local/lib/python3.10/site-packages/aiogram/utils/i18n/core.py", line 73, in find_locales
2024-04-06 22:01:45 bot            |     raise RuntimeError(f"Found locale '{name}' but this language is not compiled!")
2024-04-06 22:01:45 bot            | RuntimeError: Found locale 'en' but this language is not compiled!
bot exited with code 1

System Information:

  • Operating System: Windows 11 version 23H2 (OS Build 22631.3374)
  • Docker Desktop version: 4.28.0 (139021)
  • Docker version: 25.0.3, build 4debf41

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (9 by maintainers)

Most upvoted comments

this problem could occur due to the bot container from the docker-compose.yml used volume with the bot source code including dir bot/locales in which there were no compiled files (the compilation process was in Dockerfile) I removed the extra volumes and now compiled *.mo files remain in the container

reproduced on Mac. after manual compiling bot starts correctly