transifex

package
v0.0.0-...-27ce57f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResource

type BaseResource struct {
	ID         int      `json:"id,omitempty"`
	Slug       string   `json:"slug"`
	Name       string   `json:"name"`
	I18nType   string   `json:"i18n_type"`
	Priority   string   `json:"priority"`
	Categories []string `json:"categories"`
}

type Client

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

func NewClient

func NewClient(apiKey, org, project string) *Client

func (*Client) AddLanguage

func (c *Client) AddLanguage(lang string, coord ...string) (err error)

func (*Client) CreateResource

func (c *Client) CreateResource(u UploadResourceRequest) (r Response, err error)

func (*Client) DeleteResource

func (c *Client) DeleteResource(slug string) (err error)

func (*Client) GetStrings

func (c *Client) GetStrings(slug, lang string) (r []ResourceString, err error)

func (*Client) GetTranslation

func (c *Client) GetTranslation(slug, lang string) (r map[string]interface{}, err error)

func (*Client) GetTranslationFile

func (c *Client) GetTranslationFile(slug, lang string) (b []byte, err error)

func (*Client) Languages

func (c *Client) Languages() (langs []Language, err error)

func (*Client) ListResources

func (c *Client) ListResources() (r []Resource, err error)

func (*Client) Project

func (c *Client) Project() (p Project, err error)

func (*Client) ResourceDetail

func (c *Client) ResourceDetail(slug string) (r ResourceDetail, err error)

func (*Client) SetStringTags

func (c *Client) SetStringTags(slug, hash string, tags ...string) (err error)

func (*Client) SetTicker

func (c *Client) SetTicker(t *time.Ticker)

func (*Client) TranslateString

func (c *Client) TranslateString(slug, hash, lang, value string) (err error)

func (*Client) UpdateName

func (c *Client) UpdateName(slug, name string) (err error)

func (*Client) UpdateResource

func (c *Client) UpdateResource(slug, content string) (r Response, err error)

func (*Client) UpdateTranslation

func (c *Client) UpdateTranslation(slug, lang, content string) (r Response, err error)

type ErrResponse

type ErrResponse struct {
	ErrorCode string   `json:"error_code,omitempty"`
	Detail    string   `json:"detail,omitempty"`
	Priority  []string `json:"priority,omitempty"`
}

func (ErrResponse) Error

func (e ErrResponse) Error() string

type Language

type Language struct {
	Coordinators []string `json:"coordinators"`
	LanguageCode string   `json:"language_code"`
	Translators  []string `json:"translators"`
	Reviewers    []string `json:"reviewers"`
}

type Project

type Project struct {
	ID        int           `json:"id"`
	Name      string        `json:"name"`
	Slug      string        `json:"slug"`
	Tags      []interface{} `json:"tags"`
	Languages []struct {
		Code string `json:"code"`
		Name string `json:"name"`
	} `json:"languages"`
	TotalResources int `json:"total_resources"`
	SourceLanguage struct {
		Code string `json:"code"`
		Name string `json:"name"`
	} `json:"source_language"`
	Type            string    `json:"type"`
	LogoURL         string    `json:"logo_url"`
	Description     string    `json:"description"`
	Stringcount     int       `json:"stringcount"`
	Wordcount       int       `json:"wordcount"`
	LongDescription string    `json:"long_description"`
	WebsiteURL      string    `json:"website_url"`
	Maintainers     []string  `json:"maintainers"`
	Created         time.Time `json:"created"`
	LastUpdate      time.Time `json:"last_update"`
	Private         bool      `json:"private"`
	RepositoryURL   string    `json:"repository_url"`
	Archived        bool      `json:"archived"`
	Team            struct {
		Name string `json:"name"`
		ID   int    `json:"id"`
	} `json:"team"`
	Stats map[string]map[string]Stat `json:"stats"`
}

type Resource

type Resource struct {
	BaseResource
	SourceLanguage string `json:"source_language_code"`
}

type ResourceDetail

type ResourceDetail struct {
	BaseResource
	Stringcount        int                        `json:"stringcount"`
	Wordcount          int                        `json:"wordcount"`
	Created            time.Time                  `json:"created"`
	LastUpdate         time.Time                  `json:"last_update"`
	AcceptTranslations bool                       `json:"accept_translations"`
	Stats              map[string]map[string]Stat `json:"stats"`
}

type ResourceString

type ResourceString struct {
	Comment      string `json:"comment"`
	Context      string `json:"context"`
	Key          string `json:"key"`
	StringHash   string `json:"string_hash"`
	Reviewed     bool   `json:"reviewed"`
	Pluralized   bool   `json:"pluralized"`
	SourceString string `json:"source_string"`
	Translation  string `json:"translation"`
}

type Response

type Response struct {
	Added   int `json:"strings_added"`
	Updated int `json:"strings_updated"`
	Deleted int `json:"strings_delete"`
}

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(raw []byte) error

type Stat

type Stat struct {
	Wordcount    int       `json:"wordcount"`
	LastActivity time.Time `json:"last_activity"`
	Percentage   float64   `json:"percentage"`
	Stringcount  int       `json:"stringcount"`
	Name         string    `json:"name"`
}

type UploadResourceRequest

type UploadResourceRequest struct {
	BaseResource
	Content            string `json:"content"`
	AcceptTranslations bool   `json:"accept_translations"`
}

Jump to

Keyboard shortcuts

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