Skip to content

Commit 1645f97

Browse files
committed
revel#828 improvement in messages loading
1 parent 4596594 commit 1645f97

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

i18n.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package revel
22

33
import (
44
"fmt"
5-
"github.com/robfig/config"
65
"os"
76
"path/filepath"
87
"regexp"
98
"strings"
9+
10+
"github.com/robfig/config"
1011
)
1112

1213
const (
@@ -103,17 +104,20 @@ func getUnknownValueFormat() string {
103104
func loadMessages(path string) {
104105
messages = make(map[string]*config.Config)
105106

106-
if error := filepath.Walk(path, loadMessageFile); error != nil && !os.IsNotExist(error) {
107-
ERROR.Println("Error reading messages files:", error)
108-
}
109-
110107
// Read in messages from the modules
108+
// Load the module messges first,
109+
// so that it can be override in parent application
111110
for _, module := range Modules {
112111
TRACE.Println("Importing messages from ", filepath.Join(module.Path, messageFilesDirectory))
113-
if error := filepath.Walk(filepath.Join(module.Path, messageFilesDirectory), loadMessageFile); error != nil && !os.IsNotExist(error) {
114-
ERROR.Println("Error reading messages files:", error)
112+
if err := filepath.Walk(filepath.Join(module.Path, messageFilesDirectory), loadMessageFile); err != nil &&
113+
!os.IsNotExist(err) {
114+
ERROR.Println("Error reading messages files from module:", err)
115115
}
116116
}
117+
118+
if error := filepath.Walk(path, loadMessageFile); error != nil && !os.IsNotExist(error) {
119+
ERROR.Println("Error reading messages files:", error)
120+
}
117121
}
118122

119123
// Load a single message file

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy