Change language in Laravel 5

前端 未结 3 1243
北海茫月
北海茫月 2020-12-16 04:37

I just begin to use Laravel 5.4, In the login.blade.php i have

I don\'t like to put plain text in html code, is there a solution to make all the texts in s

3条回答
  •  暖寄归人
    2020-12-16 05:09

    Laravel has a localization module.

    Basically, you create a file, ex: resources/lang/en/login.php and put

    return [
        'header' => 'Login'
    ];
    

    And in your template you use @lang('login.header') instead of Login.

    You can have as many files in your /resources/lang/en directory and using @lang blade directive you put your file name (without extension) and desired value separated with dot.

提交回复
热议问题