laravel -- lang

来源:互联网 发布:linux批量解压缩zip 编辑:程序博客网 时间:2024/06/08 02:58

1、存放与原文件,应用程序所要支持的语言都需要再次目录建立为子目录,返回键值(字符串)对数组

2、应用程序默认语言配置 app/config/app.php中的locale配置项

/*|--------------------------------------------------------------------------| Application Locale Configuration|--------------------------------------------------------------------------|| The application locale determines the default locale that will be used| by the translation service provider. You are free to set this value| to any of the locales which will be supported by the application.|*/'locale' => 'en',/*|--------------------------------------------------------------------------| Application Fallback Locale|--------------------------------------------------------------------------|| The fallback locale determines the locale to use when the current one| is not available. You may change the value to correspond to any of| the language folders that are provided through your application.|*/'fallback_locale' => 'en',

3、从语言文件中获取文本​​

echo Lang::get('messages,welcome');​
 get()方法中第一部分为语言文件名称,第二部分为文本的名字
0 0
原创粉丝点击