Skip to content
This repository
Browse code

[lh 314] allow overriding of default messages

  • Loading branch information...
commit cb2689153c96bb0333623e94c8875559c803d438 1 parent 1580e04
Peter Hausel authored April 06, 2012
2  framework/src/play/src/main/scala/play/api/i18n/Messages.scala
@@ -227,7 +227,7 @@ class MessagesPlugin(app: Application) extends Plugin {
227 227
   import scalax.io.JavaConverters._
228 228
 
229 229
   private def loadMessages(file: String): Map[String, String] = {
230  
-    app.classloader.getResources(file).asScala.map { messageFile =>
  230
+    app.classloader.getResources(file).asScala.toList.reverse.map { messageFile =>
231 231
       new Messages.MessagesParser(messageFile.asInput, messageFile.toString).parse.map { message =>
232 232
         message.key -> message.pattern
233 233
       }.toMap
1  framework/test/integrationtest/app/controllers/Application.scala
@@ -19,6 +19,7 @@ object Application extends Controller {
19 19
 
20 20
   def index = Action {
21 21
     if (Messages("home.title")(Lang("fr")) != "ffff" ) throw new RuntimeException("i18n does not work")
  22
+    if (Messages("constraint.required") != "Hijacked" ) throw new RuntimeException("can not override default message")
22 23
     val conn = play.api.db.DB.getConnection("default")
23 24
     Cache.set("hello", "world")
24 25
     Ok(views.html.index(Cache.getAs[String]("hello").getOrElse("oh noooz")))
1  framework/test/integrationtest/conf/messages
... ...
@@ -0,0 +1 @@
  1
+constraint.required=Hijacked

0 notes on commit cb26891

Please sign in to comment.
Something went wrong with that request. Please try again.