laravel5. ★ Custom escape

Laravel 5 installed language pack
Laravel-lang, comprising 52 languages

FROM

composer require “overtrue/laravel-lang:~3.0”


Configuring
installation is complete, the project fileconfig/app.phpThe
language configuration read:

'locale' => 'zh-CN',

registered providers

Illuminate\Translation\TranslationServiceProvider::class,

Replace with:

Overtrue\LaravelLang\TranslationServiceProvider::class,

Add Custom escape language
to create a fileresources/lang/zh-CN/demo.php

<?php

return [
    'member_noexists' => '用户不存在',
];

You can be anywhere:

echo trans('member_noexists'); // 输出“用户不存在”
Released six original articles · won praise 0 · Views 326

Guess you like

Origin blog.csdn.net/weixin_42217143/article/details/104710104