diff --git a/HISTORY.md b/HISTORY.md index 7740b1c13..5a794e745 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -21,6 +21,10 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene **How to upgrade**: Open your command-line and execute this command: `go get github.com/kataras/iris/v12@latest`. +# We, 25 December 2019 | v12.1.3 + +Fix [[BUG] [iris.Default] RegisterView](https://github.com/kataras/iris/issues/1410) + # Th, 19 December 2019 | v12.1.2 Fix [[BUG]Session works incorrectly when meets the multi-level TLDs](https://github.com/kataras/iris/issues/1407). diff --git a/HISTORY_ES.md b/HISTORY_ES.md index 28edf64a0..a68d4e25b 100644 --- a/HISTORY_ES.md +++ b/HISTORY_ES.md @@ -21,17 +21,9 @@ Los desarrolladores no están obligados a actualizar si realmente no lo necesita **Cómo actualizar**: Abra su línea de comandos y ejecute este comando: `go get github.com/kataras/iris/v12@latest`. -# Th, 19 December 2019 | v12.1.2 +# We, 25 December 2019 | v12.1.3 -Not translated yet, please navigate to the [english version](HISTORY.md#th-19-december-2019--v1212) instead. - -# Mo, 16 December 2019 | v12.1.1 - -Not translated yet, please navigate to the [english version](HISTORY.md#mo-16-december-2019--v1211) instead. - -# Fr, 13 December 2019 | v12.1.0 - -Not translated yet, please navigate to the [english version](HISTORY.md#fr-13-december-2019--v1210) instead. +Not translated yet, please navigate to the [english version](HISTORY.md#we-25-december-2019--v1213) instead. # Sábado, 26 de octubre 2019 | v12.0.0 diff --git a/README.md b/README.md index f66c484c1..9b8d336db 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ![](https://iris-go.com/images/santa.png) Merry Christmas everyone! -![](https://iris-go.com/images/release.png) Iris version 12.1.2 has been [released](HISTORY.md#th-19-december-2019--v1212)! +![](https://iris-go.com/images/release.png) Iris version 12.1.3 has been [released](HISTORY.md#we-25-december-2019--v1213)! ![](https://iris-go.com/images/cli.png) The official Iris Command Line Interface will soon be near you in 2020! diff --git a/VERSION b/VERSION index 8d84a8f7d..4ab4f01a4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -12.1.2:https://github.com/kataras/iris/releases/tag/v12.1.2 \ No newline at end of file +12.1.3:https://github.com/kataras/iris/releases/tag/v12.1.3 \ No newline at end of file diff --git a/_examples/apidoc/yaag/go.mod b/_examples/apidoc/yaag/go.mod index a121c79d7..7bd6fae26 100644 --- a/_examples/apidoc/yaag/go.mod +++ b/_examples/apidoc/yaag/go.mod @@ -4,5 +4,5 @@ go 1.13 require ( github.com/betacraft/yaag v1.0.1-0.20191027021412-565f65e36090 - github.com/kataras/iris/v12 v12.1.2 + github.com/kataras/iris/v12 v12.1.3 ) diff --git a/_examples/websocket/socketio/go.mod b/_examples/websocket/socketio/go.mod index f7126b2a4..b4529e1b3 100644 --- a/_examples/websocket/socketio/go.mod +++ b/_examples/websocket/socketio/go.mod @@ -4,5 +4,5 @@ go 1.13 require ( github.com/googollee/go-socket.io v1.4.3-0.20191109153049-7451e2f8c2e0 // indirect - github.com/kataras/iris/v12 v12.1.2 + github.com/kataras/iris/v12 v12.1.3 ) diff --git a/doc.go b/doc.go index 356484036..0a2302530 100644 --- a/doc.go +++ b/doc.go @@ -38,7 +38,7 @@ Source code and other details for the project are available at GitHub: Current Version -12.1.2 +12.1.3 Installation diff --git a/iris.go b/iris.go index 7368d5472..13f145677 100644 --- a/iris.go +++ b/iris.go @@ -39,7 +39,7 @@ import ( ) // Version is the current version number of the Iris Web Framework. -const Version = "12.1.2" +const Version = "12.1.3" // HTTP status codes as registered with IANA. // See: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml. @@ -154,7 +154,8 @@ type Application struct { // view engine view view.View // used for build - builded bool + builded bool + defaultMode bool mu sync.Mutex // Hosts contains a list of all servers (Host Supervisors) that this app is running on. @@ -188,36 +189,14 @@ func New() *Application { return app } -// Default returns a new Application instance which preloads -// html view engine on "./views" and -// locales from "./locales/*/*" filepath glob pattern by current working directory. +// Default returns a new Application instance which on build state registers +// html view engine on "./views" and load locales from "./locales/*/*". // The return instance recovers on panics and logs the incoming http requests too. func Default() *Application { app := New() app.Use(recover.New()) app.Use(requestLogger.New()) - - for _, s := range []string{"./locales/*/*", "./locales/*", "./translations"} { - if _, err := os.Stat(s); os.IsNotExist(err) { - continue - } - - if err := app.I18n.Load(s); err != nil { - continue - } - - app.I18n.SetDefault("en-US") - break - } - - for _, s := range []string{"./views", "./templates", "./web/views"} { - if _, err := os.Stat(s); os.IsNotExist(err) { - continue - } - - app.RegisterView(HTML(s, ".html")) - break - } + app.defaultMode = true return app } @@ -860,6 +839,34 @@ func (app *Application) Build() error { app.builded = true rp.Err(app.APIBuilder.GetReporter()) + if app.defaultMode { // the app.I18n and app.View will be not available until Build. + if !app.I18n.Loaded() { + for _, s := range []string{"./locales/*/*", "./locales/*", "./translations"} { + if _, err := os.Stat(s); os.IsNotExist(err) { + continue + } + + if err := app.I18n.Load(s); err != nil { + continue + } + + app.I18n.SetDefault("en-US") + break + } + } + + if app.view.Len() == 0 { + for _, s := range []string{"./views", "./templates", "./web/views"} { + if _, err := os.Stat(s); os.IsNotExist(err) { + continue + } + + app.RegisterView(HTML(s, ".html")) + break + } + } + } + if app.I18n.Loaded() { // {{ tr "lang" "key" arg1 arg2 }} app.view.AddFunc("tr", app.I18n.Tr)