any chance to send email notification to the user based on his language settings?
Actually it seems to get the setting of the logged user, if user is Administrator and language is different than the user language, email are sent as Adiministrator language settings or as default system settings
def email_new_password(self, new_password=None):
if new_password and not self.flags.in_insert:
_update_password(self.name, new_password)
if self.send_password_update_notification:
frappe.set_user_lang(self.name, self.language) <--- set the language of the user to which email is sent
self.password_update_mail(new_password)
from frappe.translate import get_user_lang
frappe.set_user_lang(frappe.session.user, get_user_lang(frappe.session.user)) <--- set back to the session user language
frappe.msgprint(_("New password emailed"))
Yes, it seems like the notification system is ignoring all of the user / customer language settings. If the Customer / User / Contact is set to another language, it will still prioritize the Administrator.
I wonder why. Maybe because the Administrator is the Owner and Creator of the Notification. I’d like to fix this now.
So far I managed a cheap ugly solution, where I use 1 Notification for each language by using: doc.language == “en” and doc.language == “pt”, etc.