Skip to content

Commit

Permalink
Merry Christmas: version 12.1.3 released
Browse files Browse the repository at this point in the history
Former-commit-id: d4c9538646b8c17b32bc49b911e1535bcfe55401
  • Loading branch information
kataras committed Dec 25, 2019
1 parent 0510077 commit 5f92475
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 42 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
12 changes: 2 additions & 10 deletions HISTORY_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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!

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.1.2:https://github.com/kataras/iris/releases/tag/v12.1.2
12.1.3:https://github.com/kataras/iris/releases/tag/v12.1.3
2 changes: 1 addition & 1 deletion _examples/apidoc/yaag/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion _examples/websocket/socketio/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 34 additions & 27 deletions iris.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5f92475

Please sign in to comment.