locales

package
v0.0.0-...-732c4ef Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllLanguages

func AllLanguages() [][2]string

AllLanguages return all support language The [2]string array is like [2]string{pluginName, language.Tag.String()}

func CurrentLanguage

func CurrentLanguage() language.Tag

CurrentLanguage return current language

func CurrentLanguageName

func CurrentLanguageName() string

func Get

func Get(tag Tag, v ...interface{}) string

Get is get translate message of tag and args

func GetLanguageByName

func GetLanguageByName(name string) string

GetLanguageByName is query language by language name

func GetLanguageNameList

func GetLanguageNameList() []string

GetLanguageNameList return all language names

func InjectionPlugin

func InjectionPlugin(plugs ...Plugin) error

InjectionPlugin is load language plugin

func Printer

func Printer() *message.Printer

Printer return current Printer

func SetLanguage

func SetLanguage(lang string) error

SetLanguage is change current language to lang

Types

type Plugin

type Plugin interface {
	// Language return the plugin language tag
	Language() language.Tag
	// GetTagList return all tag and it's translate message
	GetTagList() map[Tag]string
	// Name return plugin name
	Name() string
}

Plugin is language Plugin

type Tag

type Tag string
const (
	ERROR_OPEN_PLUGIN_FAILED       Tag = "open plugin failed: %s"
	ERROR_INCORRECT_PLUGIN         Tag = "incorrect plugin: %s"
	ERROR_INITIALIZE_PLUGIN_FAILED Tag = "initialize plugin failed: %s"
	ERROR_INCORRECT_PLUGIN_FOLDER  Tag = "incorrect plugin folder: %s"
	ERROR_START_APPLICATION_FAILED Tag = "start application failed: %s"
	ERROR_ALREADY_EXISTS           Tag = "name %s already exists"
	ERROR_SAVE_FAILED              Tag = "save failed: %s"
	ERROR_REMOVE_FAILED            Tag = "delete failed: %s"
	ERROR_MARSHAL_FAILED           Tag = "marshal failed"
	ERROR_UNMARSHAL_FAILED         Tag = "unmarshal failed"
	ERROR_ENDPOINTS_REQUIRED       Tag = "endpoints required"
	ERROR_INCORRECT_ENDPOINT       Tag = "incorrect endpoint: %s"

	LOG_INFO_PLUGIN_DISCOVERY       Tag = "plugin %s discovery"
	LOG_INFO_PLUGIN_LANGUAGE_LOADED Tag = "language %s loaded"
	LOG_INFO_APPLICATION_STARTED    Tag = "application started"
	LOG_INFO_APPLICATION_STOPED     Tag = "application stopped"
	LOG_INFO_LANGUAGE_CHANGED       Tag = "language changed %s => %s"
	LOG_INFO_THEME_CHANGED          Tag = "theme changed %s => %s"
	LOG_INFO_RENEW_RENDER_WINDOWS   Tag = "renew render windows"

	FLAG_PLUGIN_FOLDER_DESCRIPTION Tag = "Set the plugin folder"

	LABEL_SELECT_LANGUAGE            Tag = "Language"
	LABEL_SELECT_THEME               Tag = "Theme"
	LABEL_THEME_DARK                 Tag = "Dark"
	LABEL_THEME_LIGHT                Tag = "Light"
	LABEL_RECORD_SIZE                Tag = "Record Window Size"
	LABEL_NEW_REDIS_NAME             Tag = "Redis Name"
	LABEL_NEW_REDIS_ENDPOINT         Tag = "Redis Endpoint"
	LABEL_NEW_REDIS_PASSWORD         Tag = "Redis Password"
	LABEL_NEW_REDIS_PLACEHOLDER      Tag = "like host:port, multi separate by \",\""
	LABEL_NEW_REDIS_NAME_PLACEHOLDER Tag = "please input a unique name"

	TITLE_SETTING_WINDOWS      Tag = "Setting"
	TITLE_REDIS_CREATE_WINDOWS Tag = "New Redis"

	BUTTON_CONFIRM      Tag = "Confirm"
	BUTTON_SAVE         Tag = "Save"
	BUTTON_CANCEL       Tag = "Cancel"
	BUTTON_EDIT_SETTING Tag = "Edit Setting"
	BUTTON_CONNECT      Tag = "Connect"
	BUTTON_DISCONNECT   Tag = "Disconnect"
)

Jump to

Keyboard shortcuts

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