Laravel Logic语言文件

I am trying to do the following:

return array(
    ...
    'hello' => 'Sehr geehrte '.($last_name ? ':salutation' . $last_name : 'Damen und Herren').',',
    ...
);

But this doesn't work as it says that $last_name is undefined (it is passed into the file however).

How can I get this to work?

You can do two language element like following ...

return array(
    ...
    'hello_with_name' => 'Sehr geehrte :salutation :last_name Damen und Herren',
    'hello' => 'Sehr geehrte :salutation Damen und Herren'
    ...
);

You can call the language items as follows ..

{{trans('language_file_name.hello_with_name', array('salutation' => $salutation, 'last_name' => $last_name)}}

{{trans('language_file_name.hello', array('salutation' => $salutation)}}