1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

New: i18n pluralization and variables support and more...

fixes: #1649, #1648, #1641, #1650

relative to: #1597
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-29 19:19:19 +03:00
parent f224ded740
commit 4065819688
63 changed files with 2054 additions and 684 deletions

View File

@@ -2491,6 +2491,12 @@ func (ctx *Context) Write(rawBody []byte) (int, error) {
//
// Returns the number of bytes written and any write error encountered.
func (ctx *Context) Writef(format string, a ...interface{}) (n int, err error) {
/* if len(a) == 0 {
return ctx.WriteString(format)
} ^ No, let it complain about arguments, because go test will do even if the app is running.
Users should use WriteString instead of (format, args)
when format may contain go-sprintf reserved chars (e.g. %).*/
return fmt.Fprintf(ctx.writer, format, a...)
}

View File

@@ -4,11 +4,15 @@ import "io"
// ViewEngine is the interface which all view engines should be implemented in order to be registered inside iris.
type ViewEngine interface {
// Load should load the templates from a physical system directory or by an embedded one (assets/go-bindata).
// Name returns the name of the engine.
Name() string
// Load should load the templates from the given FileSystem.
Load() error
// ExecuteWriter should execute a template by its filename with an optional layout and bindingData.
ExecuteWriter(w io.Writer, filename string, layout string, bindingData interface{}) error
// Ext should return the final file extension which this view engine is responsible to render.
// Ext should return the final file extension (including the dot)
// which this view engine is responsible to render.
// If the filename extension on ExecuteWriter is empty then this is appended.
Ext() string
}