Fix and improve translate()
Previous way translate() determined its source and target language was inflexible and inconvenient. For example a user always had to change target language according to whether he wants to translate into other language or his own. Improve this by assuming that user wants to translate his own language into other language when source language matches the user's locale, and the opposite if it doesn't. Also make some other improvements to logic: - translate() now doesn't send a message to user directly, and instead returns a Promise. - Also it takes a full user info instead of userId as a parameter, allowing it to detect user's locale as well.
Showing
1 changed file
with
103 additions
and
78 deletions
-
Please register or login to post a comment