Search code examples
phplaravellaravel-5localizationdefault

A default localization lang file doesn't work


I am making small fields changes to the register a user form in register.blade.php file generated by artisan make:auth by changing the Name input field to First Name

so within /resources/lang/en/moo.php I put

return [
    'fname' => 'First Name',
    'lname' => 'Last Name'
];

and in the blade template

<label for="fname">{{ __('fname') }}</label>

however the page shows fname as a result so the localization property is not applied. Any ideas what is causing the issue?


Solution

  • You need to let Laravel know which file for the translation, because you might have another fname in another file.

    {{ __('moo.fname') }}