domain

package
v3.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ErrInvalidLocation = "datetimeformatter.invalidlocation"

ErrInvalidLocation represents invalid location, i.e. time zone error

Variables

This section is empty.

Functions

This section is empty.

Types

type DateTimeFormatter

type DateTimeFormatter struct {
	DateFormat     string
	TimeFormat     string
	DateTimeFormat string
	// contains filtered or unexported fields
}

DateTimeFormatter has a couple of helpful methods to format date and times

func (*DateTimeFormatter) Format

func (dtf *DateTimeFormatter) Format(format string) string

Format datetime

func (*DateTimeFormatter) FormatDate

func (dtf *DateTimeFormatter) FormatDate() string

FormatDate formats the date

func (*DateTimeFormatter) FormatDateTime

func (dtf *DateTimeFormatter) FormatDateTime() string

FormatDateTime formats both date and time

func (*DateTimeFormatter) FormatLocale

func (dtf *DateTimeFormatter) FormatLocale(format string) string

FormatLocale formats the local time

func (*DateTimeFormatter) FormatTime

func (dtf *DateTimeFormatter) FormatTime() string

FormatTime formats the time

func (*DateTimeFormatter) FormatToLocalDate

func (dtf *DateTimeFormatter) FormatToLocalDate() string

FormatToLocalDate formats for local date

func (*DateTimeFormatter) FormatToLocalDateTime

func (dtf *DateTimeFormatter) FormatToLocalDateTime() string

FormatToLocalDateTime formats both locale date and time

func (*DateTimeFormatter) FormatToLocalTime

func (dtf *DateTimeFormatter) FormatToLocalTime() string

FormatToLocalTime formats the local time

func (*DateTimeFormatter) SetDateTime

func (dtf *DateTimeFormatter) SetDateTime(time time.Time, localtime time.Time)

SetDateTime setter for private member

func (*DateTimeFormatter) SetLocation

func (dtf *DateTimeFormatter) SetLocation(loc string) error

SetLocation sets location for local time

func (*DateTimeFormatter) SetLogger

func (dtf *DateTimeFormatter) SetLogger(logger flamingo.Logger)

SetLogger sets the logger instance

type Label

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

Label instance

func (*Label) AddFallbackLocale

func (l *Label) AddFallbackLocale(localeCode string) *Label

AddFallbackLocale on a label Deprecated: use AddFallbackLocaleCode instead

func (*Label) AddFallbackLocaleCode added in v3.2.2

func (l *Label) AddFallbackLocaleCode(localeCode string) *Label

AddFallbackLocaleCode on a label

func (*Label) GetCount

func (l *Label) GetCount() int

GetCount for label

func (*Label) GetDefaultLabel

func (l *Label) GetDefaultLabel() string

GetDefaultLabel for label

func (*Label) GetFallbackLocaleCodes added in v3.2.2

func (l *Label) GetFallbackLocaleCodes() []string

GetFallbackLocaleCodes for label

func (*Label) GetFallbacklocaleCodes

func (l *Label) GetFallbacklocaleCodes() []string

GetFallbacklocaleCodes for label Deprecated: use GetFallbackLocaleCodes instead

func (*Label) GetKey

func (l *Label) GetKey() string

GetKey for label

func (*Label) GetLocaleCode

func (l *Label) GetLocaleCode() string

GetLocaleCode - for label

func (*Label) GetTranslationArguments

func (l *Label) GetTranslationArguments() map[string]interface{}

GetTranslationArguments for label

func (*Label) Inject

func (l *Label) Inject(translationService TranslationService)

Inject translation service

func (Label) MarshalJSON

func (l Label) MarshalJSON() ([]byte, error)

MarshalJSON implements fmt.Stringer - pinning to the non pointer by intent

func (*Label) NoFallbackLocaleCodes added in v3.2.2

func (l *Label) NoFallbackLocaleCodes() *Label

NoFallbackLocaleCodes on a label - removes any fallback locale codes

func (*Label) NoFallbackLocales

func (l *Label) NoFallbackLocales() *Label

NoFallbackLocales on a label - removes any fallback locale codes Deprecated: use NoFallbackLocaleCodes instead

func (*Label) SetCount

func (l *Label) SetCount(count int) *Label

SetCount on a label

func (*Label) SetDefaultLabel

func (l *Label) SetDefaultLabel(defaultLabel string) *Label

SetDefaultLabel on a label

func (*Label) SetFallbackLocaleCodes added in v3.2.2

func (l *Label) SetFallbackLocaleCodes(fallbackLocaleCodes []string) *Label

SetFallbackLocaleCodes on a label

func (*Label) SetFallbackLocales

func (l *Label) SetFallbackLocales(fallbackLocaleCodes []string) *Label

SetFallbackLocales on a label Deprecated: use SetFallbackLocaleCodes instead

func (*Label) SetKey

func (l *Label) SetKey(key string) *Label

SetKey on a label

func (*Label) SetLocale

func (l *Label) SetLocale(localeCode string) *Label

SetLocale on a label Deprecated: use SetLocaleCode instead

func (*Label) SetLocaleCode added in v3.2.2

func (l *Label) SetLocaleCode(localeCode string) *Label

SetLocaleCode on a label

func (*Label) SetTranslationArguments

func (l *Label) SetTranslationArguments(translationArguments map[string]interface{}) *Label

SetTranslationArguments sets the argument map

func (Label) String

func (l Label) String() string

String implements fmt.Stringer - pinning to the non pointer by intent

type TranslationService

type TranslationService interface {
	Translate(key string, defaultLabel string, localeCode string, count int, translationArguments map[string]interface{}) string
	TranslateLabel(label Label) string
	AllTranslationKeys(localeCode string) []string
}

TranslationService defines the translation service

Jump to

Keyboard shortcuts

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