The account picked the language
My social auto-reply script has one function that writes the reply text. It chose the language from a default set for each account. The Korean account replied in Korean, the English account in English.
Each account has a main audience, so this looked fine. But under this setup, a Japanese comment on the Korean account gets a Korean reply. The bot answers in a language the commenter may not read.
When your automation picks a reply language, what does it look at? A setting on your side, or the text the other person actually wrote?
The account language was a guess
The account default only guessed that most people seeing this account use this language. The comment itself shows the language the person actually used. Better information was right there, and the code went with the guess.
Following the comment every time has its own risk. Some comments give almost nothing to go on, like a single emoji or a short exclamation. Forcing a language guess on those can produce a reply in the wrong language.
What would you do with a comment whose language you can't tell?
What changed
- The reply function now detects the comment's language and puts it ahead of the account default.
- Ambiguous comments still get a reply in the account language.
- The safety fallback, the text sent when generation fails, now exists for each language too. If the main reply had switched to Japanese while the fallback stayed in one language, the same mismatch would have come back through the failure path.
The result: a Japanese comment on the Korean account now gets a Japanese reply. The change is 22 lines in the function, plus a separate 42-line test file that checks which language gets picked.
Self-check
- Does your auto-reply or notification choose its language from the recipient's input rather than a setting on your side?
- Have you decided explicitly what language to use when the input is too short or unclear to classify?
- Does your failure fallback choose its language the same way as the main response?
The honest part
I don't know how many comments came in other languages while the bot only used the account language, or how those people took the replies. I also haven't checked detection accuracy on short, real comments beyond the test cases. This change only fixes how the reply language is chosen. Whether that works on real comments is still something I have to watch.