-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Search modules for message files as well #828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: NotZippy <notzippy@gmail.com>
@notzippy can you please provide steps to verify that this works from a new app to the expected results? Please & thank you. |
Steps, I create a module called
(Had to run in production mode since the module is appended to the production section of the app.conf) Additional notes,
|
So, here is a short summary:
|
Yes this allows modules to declare there own 18n messages. I was not aware On Fri, Jan 2, 2015, 6:41 AM anonx notifications@github.com wrote:
|
@notzippy To import routes from the module, update your app's |
@AnonX @notzippy importing module routes is in the Revel manual under "Routing Modules". |
@brendensoares @AnonX thx, learn something new every day... |
@@ -91,6 +91,14 @@ func loadMessages(path string) { | |||
if error := filepath.Walk(path, loadMessageFile); error != nil && !os.IsNotExist(error) { | |||
ERROR.Println("Error reading messages files:", error) | |||
} | |||
|
|||
// Read in messages from the modules | |||
for _, module := range Modules { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better to add a MessagesPaths
similar to TemplatePaths
in revel.go
instead of accessing Modules directly. Thoughts? It's a minor difference, but more consistent with the current module convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Messages is a different beast to begin with. It is loaded through an init
method and OnAppStart
. Templates are loaded in server.go:run. To me neither seem totally correct, exposing TemplatePaths seems unnecessary (as does ConfPaths and CodePaths). My thoughts are that the revel:addModule method should have a callBack list of items to be notified when a module is added, (with the possibility of adding more callbacks in the config). Each item then would take care of initializing its own area. However I do not want to even look at this until after we have broken completed the breaking up of revel.
For the intermediate time though I think this is a valuable PR even if it is not implemented in the same way as the templates.
@brendensoares Can u merge the develop branch into master ASAP, people are referinging stuff.. and we need to go!!!!!!!!!!!! or shall i commit to master myself.. he thinks !!! |
@pedromorgan what do you mean "referinging stuff"? Don't merge into |
Will this make the 0.12 release ? Or will it be deferred till later ? |
@notzippy No, this PR is not the correct way to go about loading i18n files in modules.
|
@brendensoares We are using Modules directly in |
@brendensoares Why is it important to store the messagesPath ? After the message dictionary is built is there any need for the path to be stored ? Perhaps if I understood the usefulness of this it would make more sense. |
@AnonX @notzippy I'm thinking that we have a user configurable "Separation of Concerns" seems like a good pattern to follow in general and this is an opportunity to use it. Agreed? |
This patch searches the modules for message files as well. This enhances modules so they can also provide translations with the packages.