Documentation ¶
Overview ¶
Package i18n provides functions for dealing with internationalisation of services.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// DefaultLocale is the default locale is set to english for simplicity.
DefaultLocale = "en"
)
Functions ¶
func ContextWithLocale ¶
ContextWithLocale takes a context and a locale and returns a new context with the locale embedded.
Example ¶
package main import ( "context" "github.com/LUSHDigital/core/i18n" ) var ctx context.Context func main() { ctx = i18n.ContextWithLocale(context.Background(), "sv") }
Output:
func LocaleFromContext ¶
LocaleFromContext extracts the locale from the supplied context.
Example ¶
package main import ( "context" "github.com/LUSHDigital/core/i18n" ) var ( ctx context.Context locale string ) func main() { locale = i18n.LocaleFromContext(ctx) }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.