我正在寻找文档@ https://laravel.com/docs/5.2/localization#overriding-vendor-language-files并发现了

如果指定的语言行不存在,trans函数将只返回语言行键 . 因此,使用上面的示例,trans函数将返回messages.welcome如果语言行不存在 .

所以,语言文件看起来像这样

return [
'notBlank.price' => 'Price is required',
'notBlank.AreaSelector' => 'Location is required',
];

所以...现在我需要在这个文件中插入语言行,如果它没有激发,在底部测试中 .

trans('notBlank.price'); // found and returns Price is required
trans('notBlank.AreaSelector'); // found and returns Location is required
trans('notBlank.Testing'); // not found, so needs to be inserted

我不想在vendor \ laravel \ framework \ src \ Illuminate \ Translation \中修复它,但在其他一些层面上,也许是服务提供商 .