Reputation: 319
This question is a follow-up/attempt to implement the answer from a prior question.
My attempt to pluck values from a collection and apply the current localization is as follows:
$prefix_array = ['' => trans('registration.prefixes.select')] +
$prefixes->pluck('prefix', 'prefix')->map(function($item, $key) {
return trans('messages.fields.prefixes.'.$item);
})->toArray();
However, this produces an array with values like:
"Mrs." => "messages.fields.prefixes.Mrs."
Instead of:
"Mrs." => "Sra." // eg: shortened Senora for Spanish translation
The localization path (messages.fields.prefixes.XYZ) is correct and references to it in other places displays as expected.
Upvotes: 0
Views: 146
Reputation: 3030
It may be trailing dot (period) is confusing the localisation. You may need to have your translation key as just 'mrs' => 'Mrs.'
Upvotes: 1