Kindly tell me if path of messages file can be changed from conf folder to some other path. If yes, how can I implement it.
Asked
Active
Viewed 1,294 times
2
-
Kindly provide some options.. – user2800089 Dec 09 '13 at 13:31
-
Check this http://stackoverflow.com/questions/10392545/custom-configuration-files-play-framework-2-0 – manish Dec 10 '13 at 12:40
-
This thread should have the solution you are looking for https://stackoverflow.com/questions/33593310/play-framework-i18n-messages-in-subfolders/61363843#61363843 – cglotr Apr 22 '20 at 11:25
1 Answers
0
The messages plugin which is where the localized messages are loaded, loads them from the class path root. When play compiles/packages it puts everything in conf/ in the root of the jar. You could place identical files somewhere you add on the classpath when starting play and those should be picked up, not sure about priority if the same key exists in more than one file though.
You can see the logic that loads the message files here: https://github.com/playframework/playframework/blob/2.2.x/framework/src/play/src/main/scala/play/api/i18n/Messages.scala#L284-L290

johanandren
- 11,249
- 1
- 25
- 30
-
where is classpath mentioned which i can override or change the key value pair for mentioning my messages path. – user2800089 Jan 02 '14 at 06:44
-
I don't think it is mentioned anywhere in the play docs its just the way java applications work, so you would need to find a way to put the stuff you want on the classpath. Could be either by providing it as libraries you add as dependencies or by modifying the JVM classpath parameter when you start your play app. – johanandren Jan 02 '14 at 22:16
-
If i am adding it as library or as some dependency , i guess ,play application will not load messages file by default as it used to do in default manner when messages file are present in conf folder.how to resolve this issue. – user2800089 Jan 03 '14 at 06:54
-
Not sure if I understand the question but the code loading the files will load every occurrence of the message files available on classpath, so the default messages file is read even if you also provide one in a library. – johanandren Jan 03 '14 at 14:16