Documentation
¶
Index ¶
- func LoadLocalize(path string, localizer Localizer) (map[string]any, error)
- func RegisterAfterTranslate(fn AfterTranslate)
- func RegisterBeforeTranslate(fn BeforeTranslate)
- func RegisterLocalizer(name string, v Localizer)
- func RegisterTransctor(tt TransacteType, t Translator)
- func Translate(c *TransacteConfig) error
- type AfterTranslate
- type BeforeTranslate
- type DeeplFreeCommonJobParams
- type DeeplFreeJob
- type DeeplFreeJobSentences
- type DeeplFreeLang
- type DeeplFreeLangPreference
- type DeeplFreeParams
- type DeeplFreeReq
- type DeeplFreeResp
- type DeeplFreeResult
- type DeeplFreeResultTranslations
- type DeeplFreeResultTranslationsBeams
- type DeeplFreeResultTranslationsSentences
- type Language
- type Localizer
- type LocalizerHandle
- type TranCache
- type TranTx
- type TransacteConfig
- type TransacteType
- type TransacterDeeplFree
- type TransacterGoogleFree
- type TranslaterHandler
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAfterTranslate ¶
func RegisterAfterTranslate(fn AfterTranslate)
func RegisterBeforeTranslate ¶
func RegisterBeforeTranslate(fn BeforeTranslate)
func RegisterLocalizer ¶
func RegisterTransctor ¶
func RegisterTransctor(tt TransacteType, t Translator)
func Translate ¶
func Translate(c *TransacteConfig) error
Types ¶
type AfterTranslate ¶
type BeforeTranslate ¶
type DeeplFreeJob ¶
type DeeplFreeJob struct { Kind string `json:"kind"` Sentences []*DeeplFreeJobSentences `json:"sentences"` RawEnContextBefore []string `json:"raw_en_context_before"` RawEnContextAfter []string `json:"raw_en_context_after"` //PreferredNumBeams int `json:"preferred_num_beams"` Quality string `json:"quality"` }
type DeeplFreeJobSentences ¶
type DeeplFreeLang ¶
type DeeplFreeLang struct { TargetLang string `json:"target_lang"` Preference *DeeplFreeLangPreference `json:"preference"` SourceLangComputed string `json:"source_lang_computed"` }
type DeeplFreeLangPreference ¶
type DeeplFreeParams ¶
type DeeplFreeParams struct { Jobs []*DeeplFreeJob `json:"jobs"` Lang *DeeplFreeLang `json:"lang"` Priority int `json:"priority"` CommonJobParams *DeeplFreeCommonJobParams `json:"commonJobParams"` }
type DeeplFreeReq ¶
type DeeplFreeReq struct { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Params *DeeplFreeParams `json:"params"` }
type DeeplFreeResp ¶
type DeeplFreeResp struct { Jsonrpc string `json:"jsonrpc"` Result *DeeplFreeResult `json:"result"` }
type DeeplFreeResult ¶
type DeeplFreeResult struct { Translations []*DeeplFreeResultTranslations `json:"translations"` TargetLang string `json:"target_lang"` SourceLang string `json:"source_lang"` SourceLangIsConfident bool `json:"source_lang_is_confident"` DetectedLanguages struct { } `json:"detectedLanguages"` }
type DeeplFreeResultTranslations ¶
type DeeplFreeResultTranslations struct { Beams []*DeeplFreeResultTranslationsBeams `json:"beams"` Quality string `json:"quality"` }
type DeeplFreeResultTranslationsBeams ¶
type DeeplFreeResultTranslationsBeams struct { Sentences []*DeeplFreeResultTranslationsSentences `json:"sentences"` NumSymbols int `json:"num_symbols"` }
type Localizer ¶
type Localizer interface { MarshalToFile(path string, v any) (err error) UnmarshalFromFile(path string, v any) (err error) }
func GetLocalizer ¶
type LocalizerHandle ¶
type LocalizerHandle struct {
// contains filtered or unexported fields
}
func NewLocalizerHandle ¶
func (*LocalizerHandle) MarshalToFile ¶
func (p *LocalizerHandle) MarshalToFile(path string, v any) (err error)
func (*LocalizerHandle) UnmarshalFromFile ¶
func (p *LocalizerHandle) UnmarshalFromFile(path string, v any) (err error)
type TranCache ¶
type TranCache struct {
// contains filtered or unexported fields
}
func NewTranCache ¶
type TranTx ¶
type TranTx struct {
// contains filtered or unexported fields
}
type TransacteConfig ¶
type TransacteConfig struct { SrcFile string SrcLang *Language Langs []*Language OverwriteKeyPrefix []string Overwrite bool AutoTran *state.CfgI18nAutoTran Localizer Localizer Translator Translator }
type TransacteType ¶
type TransacteType string
const ( TransacteTypeGoogleFree TransacteType = "google-free" TransacteTypeDeeplFree TransacteType = "deepl-free" )
type TransacterDeeplFree ¶
type TransacterDeeplFree struct {
// contains filtered or unexported fields
}
func NewTransacterDeeplFree ¶
func NewTransacterDeeplFree() *TransacterDeeplFree
type TransacterGoogleFree ¶
type TransacterGoogleFree struct {
// contains filtered or unexported fields
}
func NewTransacterGoogleFree ¶
func NewTransacterGoogleFree() *TransacterGoogleFree
type TranslaterHandler ¶
type TranslaterHandler struct {
// contains filtered or unexported fields
}
func NewTranslaterHandler ¶
type Translator ¶
func GetTranslator ¶
func GetTranslator(tt TransacteType) (Translator, bool)
Click to show internal directories.
Click to hide internal directories.