translate

package
v0.0.0-...-896db50 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildJSON

func BuildJSON(trans map[string]string) string

BuildJSON return a JSON string representing the map of strings

func GetTranslated

func GetTranslated(src map[string]string, wantedlang string) string

GetTranslated is a helper, get a translation from a map[string][string], with fallback

func GetTranslatedFromTr

func GetTranslatedFromTr(trs interface{}, wantedlang string, fieldname string) string

GetTranslatedFromTr return the translation of a []Table_tr object style

func MergeIn

func MergeIn(newTrans map[string]string, oldTrans map[string]string)

MergeIn will merge oldTrans in newTrans, only key in newTrans will exists, others from oldTrans will not be imported

func PlateToTree

func PlateToTree(trans map[string]string) map[string]interface{}

PlateToTree convert a plate map to a tree map

func ReadTranslation

func ReadTranslation(lang string, side string) (res map[string]string, err error)

ReadTranslation will load a translation file (json format). side is "server", "web" or "*" meaning server+web merged

func Reinit

func Reinit()

func T

func T(lang string, key string, a ...interface{}) string

T will return the translation represented by the key string and the wanted language. Translation can use fmt formats

func TWeb

func TWeb(lang string, key string, a ...interface{}) string

TWeb will return the translation represented by the key string and the wanted language. Translation can use fmt formats

func WriteJSON

func WriteJSON(trans map[string]interface{}, lang string, side string) (err error)

WriteJSON writes json where it should be, using map of strings

Types

This section is empty.

Jump to

Keyboard shortcuts

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