localization

package
v0.7.12 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HONKAI_BASE_URL  = "https://gitlab.com/Dimbreath/turnbasedgamedata/-/raw/main/TextMap/TextMap%s.json"
	GENSHIN_BASE_URL = "https://gitlab.com/Dimbreath/AnimeGameData/-/raw/master/TextMap/TextMap%s.json"
)

Variables

View Source
var (
	LoadGenshin  = true
	LoadStarRail = true
)

Functions

func GetGenshinLocale

func GetGenshinLocale(nameable hash.Nameable) *string

GetGenshinLocale tries to retrieve the string for a hash in Genish impact. Takes a nameable and returns a nilable string

Methods on structs will use GetGensinLocaleOrHash, call this directly for full control over its behavior

func GetGenshinLocaleOrHash

func GetGenshinLocaleOrHash(nameable hash.Nameable) string

GetGenshinLocaleOrHash tries to retrieve the string for a hash in Genish impact

Returns the hash if the string is not found

func GetHsrLocale added in v0.6.0

func GetHsrLocale(nameable hash.Nameable) *string

GetHsrLocale tries to retrieve the string for a hash in Honkai: Star Rail. Takes a nameable and returns a nilable string

Methods on structs will use GetHsrLocaleOrHash, call this directly for full control over its behavior

func GetHsrLocaleOrHash added in v0.6.0

func GetHsrLocaleOrHash(nameable hash.Nameable) string

GetHsrLocaleOrHash tries to retrieve the string for a hash in Honkai: Star Rail

Returns the hash if string is not found

func Init

func Init(logger zerolog.Logger, caches ...Cache)

func SetLocalization

func SetLocalization(locale LocalizationKey, flushOld ...bool)

SetLocalization updates the localization for the given language. Removes current locale if flushOld is true

Types

type Cache added in v0.6.0

type Cache interface {
	Load(s string) ([]byte, error)
	Save(s string, data []byte) error
}

type Localization

type Localization struct {
	// contains filtered or unexported fields
}

func Get

func Get() *Localization

type LocalizationKey

type LocalizationKey string
const (
	TRADITIONAL_CHINESE LocalizationKey = "CHT"
	SIMPLIFIED_CHINESE  LocalizationKey = "CHS"
	GERMAN              LocalizationKey = "DE"
	ENGLISH             LocalizationKey = "EN"
	ESPANOL             LocalizationKey = "ES"
	FRANCAIS            LocalizationKey = "FR"
	INDONESIAN          LocalizationKey = "ID"
	// Do not use for Honkai: Star Rail
	ITALIAN    LocalizationKey = "IT"
	JAPANESE   LocalizationKey = "JP"
	KOREAN     LocalizationKey = "KR"
	PORTUGUESE LocalizationKey = "PT"
	RUSSIAN    LocalizationKey = "RU"
	THAI       LocalizationKey = "TH"
	// Do not use for Honkai: Star Rail
	TURKISH    LocalizationKey = "TR"
	VIETNAMESE LocalizationKey = "VI"
)

Jump to

Keyboard shortcuts

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