Documentation
¶
Index ¶
- Constants
- func StateDict() func(int) string
- type Addon
- type Component
- func (c *Component) AllowTranslationPropagation() string
- func (c *Component) Branch() string
- func (c *Component) CheckFlags() string
- func (c *Component) CreateTranslation(languageCode string) (*Translation, error)
- func (c *Component) DeleteTranslation(languageCode string) error
- func (c *Component) EditTemplate() bool
- func (c *Component) EnableSuggestions() string
- func (c *Component) FileFormat() string
- func (c *Component) Filemask() string
- func (c *Component) GetAllTranslations() []*Translation
- func (c *Component) GetTranslation(languageCode string) *Translation
- func (c *Component) ID() int
- func (c *Component) InstallAddon(name string) (*Addon, error)
- func (c *Component) LanguageRegex() string
- func (c *Component) License() string
- func (c *Component) LicenseURL() string
- func (c *Component) Name() string
- func (c *Component) NewBase() string
- func (c *Component) NewTranslation(languageCode string) (*Translation, error)
- func (c *Component) Project() *Project
- func (c *Component) Push() string
- func (c *Component) PushBranch() string
- func (c *Component) Repo() string
- func (c *Component) Restricted() bool
- func (c *Component) Slug() string
- func (c *Component) SourceLanguage() string
- func (c *Component) String() string
- func (c *Component) Template() string
- func (c *Component) Translations() []*Translation
- func (c *Component) Vcs() string
- type Group
- type Project
- func (p *Project) Components() []*Component
- func (p *Project) CreateComponent(...) (*Component, error)
- func (p *Project) GetAllComponents() []*Component
- func (p *Project) GetComponent(slug string) *Component
- func (p *Project) Name() string
- func (p *Project) NewComponent(...) (*Component, error)
- func (p *Project) Slug() string
- func (p *Project) SourceReview() bool
- func (p *Project) String() string
- func (p *Project) TranslationReview() bool
- func (p *Project) Web() string
- func (p *Project) Weblate() *Weblate
- type Translation
- func (t *Translation) Component() *Component
- func (t *Translation) DeleteTranslation() error
- func (t *Translation) Filename() string
- func (t *Translation) GetAllUnits() []*Unit
- func (t *Translation) GetUnit(id int) *Unit
- func (t *Translation) IsSource() bool
- func (t *Translation) LanguageCode() string
- func (t *Translation) String() string
- func (t *Translation) Units() []*Unit
- type Unit
- func (u *Unit) Context() string
- func (u *Unit) Explanation() string
- func (u *Unit) ExplanationUpdate(explanation string) *Unit
- func (u *Unit) ExtraFlags() string
- func (u *Unit) ExtraFlagsUpdate(flags string) *Unit
- func (u *Unit) Flags() string
- func (u *Unit) FullUpdate(state int, target []string, explanation, extraFlags string) *Unit
- func (u *Unit) ID() int
- func (u *Unit) Note() string
- func (u *Unit) Source() []string
- func (u *Unit) State() int
- func (u *Unit) String() string
- func (u *Unit) Target() []string
- func (u *Unit) Translation() *Translation
- func (u *Unit) TranslationUpdate(state int, target []string, extraFlags string) *Unit
- func (u *Unit) Url() string
- type User
- func (u *User) AddToGroup(group *Group) error
- func (u *User) DateJoined() string
- func (u *User) Email() string
- func (u *User) FullName() string
- func (u *User) GetDateJoined() string
- func (u *User) GetGroups() []*Group
- func (u *User) Groups() []*Group
- func (u *User) IsActive() bool
- func (u *User) IsSuperuser() bool
- func (u *User) SetActive(active bool) error
- func (u *User) SetSuperuser(superuser bool) error
- func (u *User) String() string
- func (u *User) UserName() string
- func (u *User) Weblate() *Weblate
- type Weblate
- func (w *Weblate) CreateProject(name, slug, web string, sourceReview, translationReview bool) (*Project, error)
- func (w *Weblate) GetAllGroups() []*Group
- func (w *Weblate) GetAllProjects() []*Project
- func (w *Weblate) GetAllUnits() []*Unit
- func (w *Weblate) GetAllUsers() []*User
- func (w *Weblate) GetComponent(targetURL string) *Component
- func (w *Weblate) GetGroup(groupID int) *Group
- func (w *Weblate) GetGroupByName(groupName string) *Group
- func (w *Weblate) GetGroupByURL(url string) (*Group, error)
- func (w *Weblate) GetProject(slug string) *Project
- func (w *Weblate) GetTranslation(targetURL string) *Translation
- func (w *Weblate) GetUser(userName string) *User
- func (w *Weblate) NewProject(name, slug, web string, sourceReview, translationReview bool) (*Project, error)
Constants ¶
const ( Untranslated = 0 NeedsEditing = 10 WaitingForReview = 20 Approved = 30 ReadOnly = 100 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Addon ¶ added in v1.0.7
type Addon struct {
// contains filtered or unexported fields
}
Addon struct
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component struct
func (*Component) AllowTranslationPropagation ¶ added in v1.0.18
AllowTranslationPropagation getter
func (*Component) CreateTranslation ¶
func (c *Component) CreateTranslation(languageCode string) (*Translation, error)
CreateTranslation create new component from local data
func (*Component) DeleteTranslation ¶ added in v1.0.0
func (*Component) EnableSuggestions ¶ added in v1.0.18
EnableSuggestions getter
func (*Component) GetAllTranslations ¶
func (c *Component) GetAllTranslations() []*Translation
GetAllTranslations return all component translations
func (*Component) GetTranslation ¶
func (c *Component) GetTranslation(languageCode string) *Translation
GetTranslation return translation from api
func (*Component) InstallAddon ¶ added in v1.0.7
Install addon for a component
func (*Component) LanguageRegex ¶ added in v1.0.0
LanguageRegex getter
func (*Component) NewTranslation ¶
func (c *Component) NewTranslation(languageCode string) (*Translation, error)
NewTranslation get translation or create if not exists
func (*Component) SourceLanguage ¶
SourceLanguage getter
func (*Component) Translations ¶
func (c *Component) Translations() []*Translation
Translations getter
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group struct
func (*Group) AddUserByName ¶
AddUserByName AddUser by userName
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project struct
func (*Project) CreateComponent ¶
func (p *Project) CreateComponent(branch, name, slug, fileFormat, filemask, languageRegex, repo, template, vcs, push, pushBranch, sourceLanguage string, editTemplate bool, check_flags string, allow_translation_propagation string, enable_suggestions string) (*Component, error)
CreateComponent create new component from local data
func (*Project) GetAllComponents ¶
GetAllComponents return all project components
func (*Project) GetComponent ¶
GetComponent return component from api
func (*Project) NewComponent ¶
func (p *Project) NewComponent(branch, name, slug, fileFormat, filemask, languageRegex, repo, template, vcs, push, pushBranch, sourceLanguage string, editTemplate bool, check_flags string, allow_translation_propagation string, enable_suggestions string) (*Component, error)
NewComponent get component or create if not exists
func (*Project) SourceReview ¶ added in v1.0.8
SourceReview getter
func (*Project) TranslationReview ¶ added in v1.0.8
TranslationReview getter
type Translation ¶
type Translation struct {
// contains filtered or unexported fields
}
Translation struct
func (*Translation) DeleteTranslation ¶ added in v1.0.0
func (t *Translation) DeleteTranslation() error
func (*Translation) GetAllUnits ¶
func (t *Translation) GetAllUnits() []*Unit
GetAllUnits return all units for translation
func (*Translation) GetUnit ¶
func (t *Translation) GetUnit(id int) *Unit
GetUnit return translation from api
func (*Translation) String ¶
func (t *Translation) String() string
type Unit ¶
type Unit struct {
// contains filtered or unexported fields
}
Unit struct
func (*Unit) ExplanationUpdate ¶ added in v1.0.0
ExplanationUpdate unit
Explanation and flags can be set only on source language
func (*Unit) ExtraFlagsUpdate ¶ added in v1.0.0
ExtraFlagsUpdate unit
Explanation and flags can be set only on source language
func (*Unit) FullUpdate ¶ added in v1.0.0
FullUpdate unit, with limitations based on the previous state and user rights
0 -> 10: OK 10 -> 20: OK 20 -> 30: review workflow must be set up on the project 30 -> 100: can not be done -> read-only can be set only via read-only flag explanation and flags can be set only on source language, use partial update on translation languages
func (*Unit) TranslationUpdate ¶ added in v1.0.0
TranslationUpdate unit, with limitations based on the previous state and user rights
0 -> 10: OK 10 -> 20: OK 20 -> 30: review workflow must be set up on the project 30 -> 100: can not be done -> read-only can be set only via read-only flag explanation and flags can be set only on source language, use full update to set them (only on source language)
type User ¶
type User struct {
// contains filtered or unexported fields
}
User struct
func (*User) AddToGroup ¶
AddToGroup Add user to group
func (*User) SetSuperuser ¶
SetSuperuser Set if user is Superuser
type Weblate ¶
type Weblate struct {
// contains filtered or unexported fields
}
Weblate basic library struct holds complete state
func (*Weblate) CreateProject ¶
func (w *Weblate) CreateProject(name, slug, web string, sourceReview, translationReview bool) (*Project, error)
CreateProject create new project from local data
func (*Weblate) GetAllProjects ¶
GetAllProjects GetAllProjects
func (*Weblate) GetComponent ¶
GetComponent return component from api recursively, based on url e.g. https://weblate.com/api/translations/test/test/ Url format: {site:https://weblate.com/api = it is ignored}/{project:test = to solve the project}/{component:test = to solve the component}/
func (*Weblate) GetGroupByName ¶
GetGroupByName get group by name
func (*Weblate) GetGroupByURL ¶
GetGroupByURL get group by url
func (*Weblate) GetProject ¶
GetProject return project from api
func (*Weblate) GetTranslation ¶
func (w *Weblate) GetTranslation(targetURL string) *Translation
GetTranslation return translation from api recursively, based on url e.g. https://weblate.com/api/translations/test/test/en_devel/
Url format example:
{site:https://weblate.com/api -> it is ignored}/{project:test}/{component:test}/{language code:en_devel}