Documentation
¶
Index ¶
- func MoToBytes[T po.EntriesOrFile](f T, opts ...MoOption) []byte
- func MoToFile[T po.EntriesOrFile](f T, path string, opts ...MoOption) error
- func MoToWriter[T po.EntriesOrFile](f T, w io.Writer, opts ...MoOption) error
- func PoToBytes[T po.EntriesOrFile](f T, opts ...PoOption) []byte
- func PoToFile[T po.EntriesOrFile](f T, path string, opts ...PoOption) error
- func PoToString[T po.EntriesOrFile](f T, opts ...PoOption) string
- func PoToWriter[T po.EntriesOrFile](f T, w io.Writer, opts ...PoOption) error
- type MoCompiler
- func (mc *MoCompiler) SetFile(f *po.File)
- func (mc MoCompiler) ToBytes() []byte
- func (mc *MoCompiler) ToBytesWithOptions(options ...MoOption) []byte
- func (mc MoCompiler) ToFile(f string) error
- func (mc *MoCompiler) ToFileWithOptions(f string, options ...MoOption) error
- func (mc MoCompiler) ToWriter(w io.Writer) error
- func (mc *MoCompiler) ToWriterWithOptions(w io.Writer, opts ...MoOption) error
- type MoConfig
- type MoOption
- type PoCompiler
- func (c *PoCompiler) SetFile(f *po.File)
- func (c PoCompiler) ToBytes() []byte
- func (c *PoCompiler) ToBytesWithOptions(opts ...PoOption) []byte
- func (c PoCompiler) ToFile(f string) error
- func (c *PoCompiler) ToFileWithOptions(f string, opts ...PoOption) error
- func (c PoCompiler) ToString() string
- func (c *PoCompiler) ToStringWithOptions(opts ...PoOption) string
- func (c PoCompiler) ToWriter(w io.Writer) error
- func (c *PoCompiler) ToWriterWithOptions(w io.Writer, opts ...PoOption) error
- type PoConfig
- type PoLocationMode
- type PoOption
- func PoWithAddLocation(loc PoLocationMode) PoOption
- func PoWithCommentFuzzy(c bool) PoOption
- func PoWithConfig(cfg PoConfig) PoOption
- func PoWithCopyrightHolder(holder string) PoOption
- func PoWithCustomObsoletePrefixRune(r rune) PoOption
- func PoWithForcePo(f bool) PoOption
- func PoWithForeignUser(f bool) PoOption
- func PoWithHeaderComments(hc bool) PoOption
- func PoWithHeaderFields(w bool) PoOption
- func PoWithIgnoreErrors(i bool) PoOption
- func PoWithLogger(logger *log.Logger) PoOption
- func PoWithMsgstrPrefix(prefix string) PoOption
- func PoWithMsgstrSuffix(suffix string) PoOption
- func PoWithNoLocation(n bool) PoOption
- func PoWithOmitHeader(o bool) PoOption
- func PoWithPackageName(name string) PoOption
- func PoWithTitle(t string) PoOption
- func PoWithUseCustomObsoletePrefix(u bool) PoOption
- func PoWithVerbose(v bool) PoOption
- func PoWithWordWrap(w bool) PoOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MoToWriter ¶
func PoToString ¶
func PoToString[T po.EntriesOrFile](f T, opts ...PoOption) string
func PoToWriter ¶
Types ¶
type MoCompiler ¶
func (*MoCompiler) SetFile ¶
func (mc *MoCompiler) SetFile(f *po.File)
func (MoCompiler) ToBytes ¶
func (mc MoCompiler) ToBytes() []byte
func (*MoCompiler) ToBytesWithOptions ¶
func (mc *MoCompiler) ToBytesWithOptions(options ...MoOption) []byte
func (MoCompiler) ToFile ¶
func (mc MoCompiler) ToFile(f string) error
func (*MoCompiler) ToFileWithOptions ¶
func (mc *MoCompiler) ToFileWithOptions(f string, options ...MoOption) error
func (*MoCompiler) ToWriterWithOptions ¶
func (mc *MoCompiler) ToWriterWithOptions(w io.Writer, opts ...MoOption) error
type MoConfig ¶
type MoConfig struct {
Logger *log.Logger
Force bool
Verbose bool
IgnoreErrors bool
Sort bool
SortMode po.SortMode
// contains filtered or unexported fields
}
func DefaultMoConfig ¶
func (*MoConfig) ApplyOptions ¶
func (*MoConfig) RestoreLastCfg ¶
func (mc *MoConfig) RestoreLastCfg()
type MoOption ¶
type MoOption func(c *MoConfig)
func MoWithConfig ¶
func MoWithForce ¶
func MoWithIgnoreErrors ¶
func MoWithLogger ¶
func MoWithSort ¶
func MoWithSortMode ¶
func MoWithVerbose ¶
type PoCompiler ¶
type PoCompiler struct {
File *po.File // The source file containing translation entries.
Config PoConfig // Configuration settings for compilation.
// contains filtered or unexported fields
}
func (*PoCompiler) SetFile ¶
func (c *PoCompiler) SetFile(f *po.File)
func (PoCompiler) ToBytes ¶
func (c PoCompiler) ToBytes() []byte
func (*PoCompiler) ToBytesWithOptions ¶
func (c *PoCompiler) ToBytesWithOptions(opts ...PoOption) []byte
func (PoCompiler) ToFile ¶
func (c PoCompiler) ToFile(f string) error
func (*PoCompiler) ToFileWithOptions ¶
func (c *PoCompiler) ToFileWithOptions(f string, opts ...PoOption) error
func (PoCompiler) ToString ¶
func (c PoCompiler) ToString() string
func (*PoCompiler) ToStringWithOptions ¶
func (c *PoCompiler) ToStringWithOptions(opts ...PoOption) string
func (*PoCompiler) ToWriterWithOptions ¶
func (c *PoCompiler) ToWriterWithOptions(w io.Writer, opts ...PoOption) error
type PoConfig ¶
type PoConfig struct {
Logger *log.Logger
ForcePo bool // If true, forces the creation of a `.po` file, even if not strictly needed.
OmitHeader bool // If true, omits the header section in the generated `.po` file.
PackageName string // Name of the package associated with the translation.
CopyrightHolder string // Name of the entity holding copyright over the translation.
ForeignUser bool // If true, marks the translation as public domain.
Title string // Title to be included in the `.po` file header.
NoLocation bool // If true, suppresses location comments in the `.po` file.
AddLocation PoLocationMode // Specifies how location comments should be included ("never", "file", "full").
MsgstrPrefix string // Prefix added to all translation strings.
MsgstrSuffix string // Suffix added to all translation strings.
IgnoreErrors bool // If true, allows compilation to proceed despite non-critical errors.
Verbose bool
CommentFuzzy bool
HeaderComments bool
HeaderFields bool
WordWrap bool
UseCustomObsoletePrefix bool
CustomObsoletePrefixRune rune
// contains filtered or unexported fields
}
PoConfig holds the settings for the compiler, affecting how translations are processed.
func DefaultPoConfig ¶
func NewPoConfigFromOptions ¶
func (*PoConfig) ApplyOptions ¶
func (*PoConfig) RestoreLastCfg ¶
func (c *PoConfig) RestoreLastCfg()
type PoLocationMode ¶
type PoLocationMode string
const ( PoLocationModeFull PoLocationMode = "full" PoLocationModeNever PoLocationMode = "never" PoLocationModeFile PoLocationMode = "file" )
type PoOption ¶
type PoOption func(*PoConfig)
func PoWithAddLocation ¶
func PoWithAddLocation(loc PoLocationMode) PoOption
func PoWithCommentFuzzy ¶
func PoWithConfig ¶
func PoWithCopyrightHolder ¶
func PoWithForcePo ¶
func PoWithForeignUser ¶
func PoWithHeaderComments ¶
func PoWithHeaderFields ¶
func PoWithIgnoreErrors ¶
func PoWithLogger ¶
func PoWithMsgstrPrefix ¶
func PoWithMsgstrSuffix ¶
func PoWithNoLocation ¶
func PoWithOmitHeader ¶
func PoWithPackageName ¶
func PoWithTitle ¶
func PoWithVerbose ¶
func PoWithWordWrap ¶
Click to show internal directories.
Click to hide internal directories.
