I use translate.rainlab
plugin for localization, but not sure how to translate flash messages for ajax form.
function onMailSend() {
Mail::sendTo('name@example.com', 'contact.form', post());
Flash::success('Message has been sent');
}
You can stick with using the Translate plugin's features, no need to use another translation mechanism.
use RainLab\Translate\Models\Message;
function onMailSend() {
Mail::sendTo('name@example.com', 'contact.form', post());
Flash::success(Message::trans('Message has been sent'));
}
This assumes that "Message has been sent" is the string in the default locale.