lang

package
v0.0.0-...-105f304 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2016 License: GPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleCommand

func HandleCommand(bot *telebot.Bot, message telebot.Message, args []string)

HandleCommand handles a /language command

func Load

func Load()

Load loads the language data.

func Translate

func Translate(u config.User, key string) string

Translate translates the given key in the language of the given user.

func Translatef

func Translatef(u config.User, key string, args ...interface{}) string

Translatef translates the given key in the language of the given user and then formats the translated text with the given arguments.

Types

type Language

type Language struct {
	Name string
	Data map[string]string
}

Language is a language.

func GetLanguage

func GetLanguage(lang string) *Language

GetLanguage returns a language by the given name.

func (Language) Translate

func (lng Language) Translate(key string) string

Translate translates the given key.

func (Language) Translatef

func (lng Language) Translatef(key string, args ...interface{}) string

Translatef translates the given key and then formats the translated text with the given arguments.

Jump to

Keyboard shortcuts

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