translation

package
v0.0.0-...-a11cca7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: AGPL-3.0, MIT Imports: 11 Imported by: 0

Documentation

Overview

Package translation provides a simple in-memory translation service - it may soon be renamed translate

Index

Constants

This section is empty.

Variables

View Source
var DefaultLanguage = "en"

DefaultLanguage defines a default language to fall back to

Functions

func Get

func Get(lang, key string) string

Get returns the translation for a given language and key if no result, it falls back to DefaultLanguage + key

func Load

func Load(root string) error

Load scans the path for translation lang.json files if called twice the second translations will overwrite any common keys

func Middleware

func Middleware(h http.HandlerFunc) http.HandlerFunc

Middleware sets a token on every GET request so that it can be inserted into the view. It ignores get requests for /files and /assets.

func Setup

func Setup() error

Setup sets up the initial map

Types

This section is empty.

Jump to

Keyboard shortcuts

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