Closed rbruhn closed 8 years ago
Hi !
I can confirm it works well on Laravel 4 and placeholders are supported.
If lemma are obsolete, this is just because the regular expression does not work in your case.
I use this config trans for example :
'trans_methods' => array(
'trans' => array(
'@trans\(\s*(\'.*\')\s*(,.*)*\)@U',
'@trans\(\s*(".*")\s*(,.*)*\)@U',
),
And this regular expression will not match the second parameter (placeholder definition array) on a new line for example.
Do you put placeholder definition array on a new line in your code ?
Can you send me the exact part of code where you call trans and your configuration file please ?
After finding out it does not work on multi-line, I changed those instances and they are now working. However, it appears having more than one place holder is what is messing things up.
language file:
'failed_job_message' => 'Job queue :id has failed.<br />Job Data: :jobData ',
uses:
Queue::failing(function ($connection, $job)
{
if ($job->getQueue() == Config::get('config.beanstalkd.default'))
return;
Event::fire('user.sendreport', [
'email' => null,
'subject' => trans('emails.failed_job_subject'),
'view' => 'emails.report-failed-jobs',
'data' => ['text' => trans('emails.failed_job_message', ['id' => $job->getJobId(), 'jobData' => $job->getRawBody()])],
]);
return;
});
In testing the regex, it was getting hung up on the getJobId() due to the parentheses. I reassigned them like this:
$id = $job->getJobId();
$jobData = $job->getRawBody();
'data' => ['text' => trans('emails.failed_job_message', ['id' => $id, 'jobData' => $jobData])],
However, the regex only captures the last place holder: 'jobData' => $jobData I will play around with the regex and see if I can get it to match more than one place holder.
Just playing around with this tonight and found using place holders causes the strings to be listed as obsolete. The below string, emails.failed_job_message comes back as obsolete when it obviously exists.
trans('emails.failed_job_message', ['id' => $job->getJobId(), 'jobData' => $job->getRawBody()])
Checked out a few other files where I use place holders and they were returned as well. This is when using Laravel 4. I've not checked whether it occurs on my other Laravel 5 site.