Documentation
¶
Overview ¶
* * Gosora Phrase System * Copyright Azareal 2017 - 2020 *
Index ¶
- func AddPhrase()
- func AddTmplIndexCallback(h func([][]byte))
- func ChangeLanguagePack(name string) (exists bool)
- func CurrentLanguagePackName() (name string)
- func DeletePhrase()
- func GetAccountPhrase(name string) string
- func GetAllPermPresets() map[string]string
- func GetAllSettingPhrases() map[string]string
- func GetErrorPhrase(name string) string
- func GetErrorPhraseBytes(name string) []byte
- func GetHumanLangPhrase(name string) (string, bool)
- func GetLevelPhrase(level int) string
- func GetNoticePhrase(name string) string
- func GetOSPhrase(name string) (string, bool)
- func GetPermPhrase(name string) string
- func GetSettingPhrase(name string) string
- func GetTitlePhrase(name string) string
- func GetTitlePhrasef(name string, params ...interface{}) string
- func GetTmplPhrase(name string) string
- func GetTmplPhrasef(name string, params ...interface{}) string
- func GetTmplPhrases() map[string]string
- func GetTmplPhrasesByPrefix(prefix string) (phrases map[string]string, ok bool)
- func GetTmplPhrasesBytes(tmplID int) [][]byte
- func GetUserAgentPhrase(name string) (string, bool)
- func InitPhrases(lang string) error
- func LoadLangPack(name string) error
- func RegisterTmplPhraseNames(phraseNames []string) (tmplID int)
- func SaveLangPack(langPack *LanguagePack) error
- func TmplIndexCallback(tmplID int, phraseSet [][]byte)
- func UpdatePhrase()
- type LanguagePack
- type LevelPhrases
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPhrase ¶
func AddPhrase()
? - Use runtime reflection for updating phrases? TODO: Implement these
func AddTmplIndexCallback ¶
func AddTmplIndexCallback(h func([][]byte))
func ChangeLanguagePack ¶
TODO: Use atomics to store the pointer of the current active langpack? nolint
func CurrentLanguagePackName ¶
func CurrentLanguagePackName() (name string)
func DeletePhrase ¶
func DeletePhrase()
func GetAccountPhrase ¶
func GetAllPermPresets ¶
func GetAllSettingPhrases ¶
func GetErrorPhrase ¶
TODO: Does comma ok work with multi-dimensional maps?
func GetErrorPhraseBytes ¶
func GetHumanLangPhrase ¶
func GetLevelPhrase ¶
func GetNoticePhrase ¶
func GetOSPhrase ¶
func GetPermPhrase ¶
func GetSettingPhrase ¶
func GetTitlePhrase ¶
func GetTitlePhrasef ¶
func GetTmplPhrase ¶
func GetTmplPhrasef ¶
func GetTmplPhrases ¶
func GetTmplPhrasesByPrefix ¶
func GetTmplPhrasesBytes ¶
func GetUserAgentPhrase ¶
func InitPhrases ¶
func RegisterTmplPhraseNames ¶
func TmplIndexCallback ¶
func UpdatePhrase ¶
func UpdatePhrase()
Types ¶
type LanguagePack ¶
type LanguagePack struct { Name string IsoCode string ModTime time.Time // Should we use a sync map or a struct for these? It would be nice, if we could keep all the phrases consistent. Levels LevelPhrases Perms map[string]string SettingPhrases map[string]string PermPresets map[string]string Accounts map[string]string // TODO: Apply these phrases in the software proper UserAgents map[string]string OperatingSystems map[string]string HumanLanguages map[string]string Errors map[string]string // Temp stand-in ErrorsBytes map[string][]byte NoticePhrases map[string]string PageTitles map[string]string TmplPhrases map[string]string TmplPhrasesPrefixes map[string]map[string]string // [prefix][name]phrase TmplIndicesToPhrases [][][]byte // [tmplID][index]phrase }
! For the sake of thread safety, you must never modify a *LanguagePack directly, but to create a copy of it and overwrite the entry in the sync.Map
func GetCurrentLangPack ¶
func GetCurrentLangPack() *LanguagePack
! Please don't mutate *LanguagePack
func GetLangPack ¶
func GetLangPack() *LanguagePack
func GetLanguagePackByName ¶
func GetLanguagePackByName(name string) (pack *LanguagePack, ok bool)
type LevelPhrases ¶
type LevelPhrases struct { Level string LevelMax string // ? Add a max level setting? // Override the phrase for individual levels, if the phrases exist Levels []string // index = level }
TODO: We'll be implementing the level phrases in the software proper very very soon!
Click to show internal directories.
Click to hide internal directories.