i18n

package
v6.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2017 License: MIT, Apache-2.0, MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c Config) iris.HandlerFunc

New returns a new i18n middleware

func Translate

func Translate(ctx *iris.Context, format string, args ...interface{}) string

Translate returns the translated word from a context the second parameter is the key of the world or line inside the .ini file the third parameter is the '%s' of the world or line inside the .ini file

func TranslatedMap

func TranslatedMap(sourceInterface interface{}, ctx *iris.Context) map[string]interface{}

TranslatedMap returns translated map[string]interface{} from i18n structure

Types

type Config

type Config struct {
	// Default set it if you want a default language
	//
	// Checked: Configuration state, not at runtime
	Default string
	// URLParameter is the name of the url parameter which the language can be indentified
	//
	// Checked: Serving state, runtime
	URLParameter string
	// Languages is a map[string]string which the key is the language i81n and the value is the file location
	//
	// Example of key is: 'en-US'
	// Example of value is: './locales/en-US.ini'
	Languages map[string]string
}

Config the i18n options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL