telegraf / telegraf-i18n

Internationalization middleware for Telegraf
MIT License
84 stars 31 forks source link

How can I use it in groups? #34

Open mxvsh opened 4 years ago

mxvsh commented 4 years ago

I see that it only change the language for user, and not for chats. How can I make is use chat_id only?

EdJoPaTo commented 4 years ago

The language used is loaded from session.__language_code. If its not available from the from.language_code which is the user. If that does not exist its the config.defaultLanguage.

Typically I would say this is fitting as the user is the one a message is target for. Normally a group has a different session than a user. Make sure you use the session and set the language via ctx.i18n.locale('en or whatever you want') and the group session has the language to use set.

Hope that helps :)