lundi 2 janvier 2017

Using Laravel what is the correct way to store menu item's phrases?

I am trying to use languages with Laravel 5.3.

I have a menu named gender that shows the user two options "i.e 'Male' and 'Female'".

I want to add the phrases 'Male' and 'Female' to the language file.

What is the correct way to store menu item's translation with Laravel?

I did the following

'gender_male' => 'Male',
'gender_female' => 'Female'

But then notices that that Laravel has "what I believe it to be" nested phrases. Here is an example from the code that is shipped with the Framework

'same'                 => 'The :attribute and :other must match.',
'size'                 => [
    'numeric' => 'The :attribute must be :size.',
    'file'    => 'The :attribute must be :size kilobytes.',
    'string'  => 'The :attribute must be :size characters.',
    'array'   => 'The :attribute must contain :size items.',
],

Should my language file then look like this instead? and if so how to I access I read it?

 'gender' => [
    'male' => 'Male',
    'female' => 'Female'
 ]



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire