Search code examples
laravel-5localizationtranslation

Laravel default auth module translation


I have generated the default Laravel auth module.

Everywhere in the blades of the module, I see Double Underscore __ function assuming that translation is almost there.

for example

<li>
  <a class="nav-link" href="{{ route('login') }}">
    {{ __('Login') }}
  </a>
</li>

My question: Where is the translation file? Where should I put it, if I create one?

I mean, if I go to the Laravel documentation site there are examples like this

echo __('messages.welcome');

with explanations

For example, let's retrieve the welcome translation string from the resources/lang/messages.php language file:

BUT in my example above there is no file name specified. It is only text:

__('Login')

Question is: What is used for the language file if no file specified? Is there any default? Where does it sit? Where was it set?


Solution

  • Laravel Docs Have an instruction about the json file. Yes it is not php, but json file. Example would be:

    resources/lang/es.json
    

    content

    {
        "I love programming.": "Me encanta programar."
    }
    

    Usage

    echo __('I love programming.');