i18n

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocaleLoadHook

func LocaleLoadHook(db *gorm.DB)

2. get locale fields

func LocaleUpdateHook

func LocaleUpdateHook(db *gorm.DB)

1. store locale fields

func Start

func Start()

Types

type I18nEnabled added in v0.0.28

type I18nEnabled struct {
	LocaleFields []*LocaleFieldValue `gorm:"-" json:"-"`
}

type I18nFactory

type I18nFactory struct {
	Translator Translator `inject:"translator"`
}

type LocaleFieldValue

type LocaleFieldValue struct {
	EntityName string `gorm:"column:entity_name;primaryKey" json:"entityName"`
	EntityId   string `gorm:"column:entity_id;primaryKey" json:"entityId"`
	Name       string `gorm:"column:name;primaryKey" json:"name"`
	Locale     string `gorm:"column:locale;default:en;primaryKey" json:"locale"`
	Value      string `gorm:"column:value" json:"value"`
}

type Translator

type Translator interface {
	StoreTranslations(translations []*LocaleFieldValue)
	LoadTranslations(locale, entityName string, entityId ...string) map[string][]*LocaleFieldValue
}

Jump to

Keyboard shortcuts

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