2017-05-26 72 views
0

我有一个类似于Laravel的流明中的错误消息的标准文件夹。问题是来自那里的消息没有被使用。我怎样才能让Lumen使用我的翻译来格式化消息?如何让Lumen使用默认验证信息?

现在,当我倾倒用$ validator->错误()不格式化的消息。

MessageBag {#223 
    #messages: array:4 [ 
    "surname" => array:1 [ 
     0 => "validation.required" 
    ] 
    "mobile" => array:1 [ 
     0 => "validation.required" 
    ] 
    "password" => array:1 [ 
     0 => "validation.min.string" 
    ] 
    "email" => array:1 [ 
     0 => "validation.email" 
    ] 
    ] 
    #format: ":message" 
} 
+0

您使用什么语言为您的应用程序? – Alfa

+0

@Alfa我正在使用英语 – naneri

+0

你介意分享一下你的文件夹结构吗?我无法重现这个问题。 – Alfa

回答

1

基本上translator缺少应在该实例解析之前配置的区域设置配置。添加到您的:config/app.php

/* 
|-------------------------------------------------------------------------- 
| 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' => env('APP_LOCALE', 'en'),