lang

package
v4.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2017 License: AGPL-3.0, AGPL-3.0-or-later Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Packs contains all loaded language packs
	Packs map[string]Pack
)

Functions

func Load

func Load() error

Load loads and parses all JSON language packs

Types

type Common

type Common struct {
	Posts, UI map[string]string
	Time      map[string][]string
	Plurals   map[string][2]string
}

Common contains localization common to both the server and the client

type Pack

type Pack struct {
	ID              string
	Tabs, SortModes []string
	Forms           map[string][2]string
	UI, Options     map[string]string
	Templates       map[string][]string
	Common
}

Pack contains a localization language pack for a single language

func Get

func Get(w http.ResponseWriter, r *http.Request) (Pack, error)

Get determines the language pack of the client based on fallback order: cookie || Accept-Language header || default language

Jump to

Keyboard shortcuts

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