aiogram / i18n

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] "Extract" does not comment keys whose arguments have been changed (or removed)

andrew000 opened this issue · comments

Foreword

  • Code should be in bot directory
  • Command should be running outside the bot directory

Steps

  1. python -m aiogram_i18n extract -i '.\bot' -o '.\locales\test.ftl' -cm -k 'i18n' --locales 'uk'
  2. Remove age="42" from code in start() function
  3. Re-run command from step 1

Expected behavior

  • hello-text = hello-text { $name } { $age } should be commented and new line hello-text = hello-text { $name } should be added.

Current behavior

  • hello-text = hello-text { $name } { $age } has not changed

Code to reproduce bug

import asyncio

from aiogram import Dispatcher, Bot
from aiogram.filters import Command
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram.types import Message
from aiogram_i18n import I18nContext

dp = Dispatcher(storage=MemoryStorage())


@dp.message(Command("start"))
async def start(msg: Message, i18n: I18nContext) -> None:
    await msg.reply(i18n.get("hello-text", name="Peter", age="42"))


if __name__ == '__main__':
    bot = Bot(token="42")
    asyncio.run(dp.start_polling(bot))

Requiremets

aiogram==3.2.0
aiogram_i18n==1.3.3
libcst==1.1.0
commented

Resolved in another lib