language

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const UnknownTheKeyStrf = "the key is '%v', unknown meaning"

UnknownTheCodeStrf const define unknow code

View Source
const UnknownTheLanguageStrf = "the language code is '%s', unknown meaning"

UnknownTheLanguageStrf define unknow language

Variables

View Source
var EmptyLanguageSetting = map[string]LanguageMap{}

EmptyLanguageSetting empty language setting

Functions

func LoadLanguageResourceFromDir

func LoadLanguageResourceFromDir(dir string) (map[string]LanguageMap, error)

LoadLanguageResourceFromDir load language resource from file

Types

type CCLanguageIf

type CCLanguageIf interface {
	// CreateDefaultCCLanguageIf create new language error interface instance
	CreateDefaultCCLanguageIf(language string) DefaultCCLanguageIf
	// Language returns an content with key
	Language(language, key string) string
	// Languagef returns an content with key
	Languagef(language, key string, args ...interface{}) string

	Load(res map[string]LanguageMap)
}

CCLanguageIf defines error information conversion

func New

func New(dir string) (CCLanguageIf, error)

New create new Language instance, dir is directory of language description resource

func NewFromCtx

func NewFromCtx(lang map[string]LanguageMap) CCLanguageIf

NewFromCtx get lange helper

type DefaultCCLanguageIf

type DefaultCCLanguageIf interface {
	// Language returns an content with key
	Language(key string) string
	// Errorf returns an content with key
	Languagef(key string, args ...interface{}) string
}

DefaultCCLanguageIf defines default language interface

type LanguageMap

type LanguageMap map[string]string

LanguageMap mapping

Jump to

Keyboard shortcuts

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