Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

Bilingual alert message

Hello,

I am trying to create a bilingual session flash message and has not been able to do so. Any idea how to do so?

This is what I did so far:

EmailTemplateController.php

	public function store(Request $request)
    {
    //
    $this->validate($request, [
        'name' => 'required|unique:email_templates',
        'template' => 'required',
    ]);

    $etemplate = new EmailTemplate;
    $etemplate->name = $request->name;
    $etemplate->template = $request->template;
    $etemplate->email = null;
    $etemplate->save();


    Session::flash('flash', __('etemp succeed'));

    return redirect()->back();
	}

lang/en/title.php

		 /* validation */
	   'etemp succeed' => 'Succeed creating email template',

lang/id/title.php

		/* validation */
	    'etemp succeed' => 'Sukses membuat email template',

I got this as an alert 'etemp succeed' instead of reading the message according to the language.

Thanks in advance. ref: https://laravel.com/docs/8.x/session

0 likes
1 reply
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Tell it the file

__('title.etemp succeed') 

Please or to participate in this conversation.