Documentation ¶
Index ¶
- Constants
- Variables
- func Projects(client *phrase.APIClient) ([]phrase.Project, *phrase.APIResponse, error)
- func RemoteLocales(client *phrase.APIClient, key LocalesCacheKey) ([]*phrase.Locale, *phrase.APIResponse, error)
- func StringToInterface() mapstructure.DecodeHookFunc
- func StringToOptionalBool() mapstructure.DecodeHookFunc
- func StringToOptionalString() mapstructure.DecodeHookFunc
- func UploadCleanup(client *phrase.APIClient, confirm bool, ids []string, branch string, ...) error
- func ViperStructTag() viper.DecoderConfigOption
- type ConfigYAML
- type InitCommand
- type LocaleCache
- type LocaleFile
- type LocaleFiles
- type LocalesCacheKey
- type PullCommand
- type PullParams
- type PullYAML
- type PushCommand
- type PushYAML
- type Source
- func (source *Source) CheckPreconditions() error
- func (source *Source) GetFileFormat() string
- func (source *Source) GetLocaleID() string
- func (source *Source) LocaleFiles() (LocaleFiles, error)
- func (source *Source) Push(client *phrase.APIClient, waitForResults bool, cleanup bool, branch string, ...) error
- type Sources
- type SourcesOrTargets
- type SourcesYAML
- type Target
- func (target *Target) CheckPreconditions() error
- func (target *Target) DownloadAndWriteToFile(client *phrase.APIClient, localeFile *LocaleFile, async bool) error
- func (t *Target) GetFormat() string
- func (t *Target) GetLocaleID() string
- func (t *Target) GetTags() []string
- func (target *Target) LocaleFiles() (LocaleFiles, error)
- func (target *Target) Pull(client *phrase.APIClient, async bool) error
- func (target *Target) ReplacePlaceholders(localeFile *LocaleFile) (string, error)
- type Targets
- type TargetsYAML
- type UploadCleanupCommand
- type UploadParams
Constants ¶
View Source
const ( StepAskForToken = "ask for token" StepSelectProject = "select project" StepSelectFormat = "select format" StepConfigSources = "config sources" StepConfigTargets = "config targets" StepWriteConfig = "write configuration file" StepFinished = "finished" )
The steps for a successful project initialization.
Variables ¶
View Source
var Auth context.Context
View Source
var Config *phrase.Config
View Source
var Debug bool
Functions ¶
func Projects ¶
func Projects(client *phrase.APIClient) ([]phrase.Project, *phrase.APIResponse, error)
func RemoteLocales ¶
func RemoteLocales(client *phrase.APIClient, key LocalesCacheKey) ([]*phrase.Locale, *phrase.APIResponse, error)
func StringToInterface ¶
func StringToInterface() mapstructure.DecodeHookFunc
StringToInterface returns a DecodeHookFunc that converts strings to optional.Interface.
func StringToOptionalBool ¶
func StringToOptionalBool() mapstructure.DecodeHookFunc
StringToOptionalBool returns a DecodeHookFunc that converts strings to optional.Bool.
func StringToOptionalString ¶
func StringToOptionalString() mapstructure.DecodeHookFunc
StringToOptionalString returns a DecodeHookFunc that converts strings to optional.String.
func UploadCleanup ¶
func ViperStructTag ¶
func ViperStructTag() viper.DecoderConfigOption
Types ¶
type ConfigYAML ¶
type ConfigYAML struct { Host string `yaml:"host,omitempty"` AccessToken string `yaml:"access_token,omitempty"` ProjectID string `yaml:"project_id"` FileFormat string `yaml:"file_format,omitempty"` PerPage int `yaml:"per_page,omitempty"` Defaults map[string]map[string]interface{} `yaml:"defaults,omitempty"` Push PushYAML `yaml:"push,omitempty"` Pull PullYAML `yaml:"pull,omitempty"` }
type InitCommand ¶
type InitCommand struct { phrase.Config YAML ConfigYAML FileFormat *phrase.Format // contains filtered or unexported fields }
func (*InitCommand) Run ¶
func (cmd *InitCommand) Run() error
type LocaleCache ¶
type LocaleCache map[LocalesCacheKey][]*phrase.Locale
func GetLocalesCache ¶
func GetLocalesCache(client *phrase.APIClient, sourcesOrTargets SourcesOrTargets, branch string) (LocaleCache, error)
for every source or target, retrieves and caches the list of locales
type LocaleFile ¶
func (*LocaleFile) RelPath ¶
func (localeFile *LocaleFile) RelPath() string
type LocaleFiles ¶
type LocaleFiles []*LocaleFile
type LocalesCacheKey ¶
type PullCommand ¶
func (*PullCommand) Run ¶
func (cmd *PullCommand) Run(config *phrase.Config) error
type PullParams ¶
type PullParams struct { phrase.LocaleDownloadOpts `json:",squash" mapstructure:",squash"` LocaleID string `json:"locale_id"` }
type PullYAML ¶
type PullYAML struct {
Targets []TargetsYAML `yaml:"targets,omitempty"`
}
type PushCommand ¶
type PushCommand struct { phrase.Config Wait bool Cleanup bool Branch string UseLocalBranchName bool Tag string }
func (*PushCommand) Run ¶
func (cmd *PushCommand) Run() error
type PushYAML ¶
type PushYAML struct {
Sources []SourcesYAML `yaml:"sources,omitempty"`
}
type Source ¶
type Source struct { File string `json:"file"` ProjectID string `json:"project_id"` Branch string `json:"branch"` AccessToken string `json:"access_token"` FileFormat string `json:"file_format"` Params *UploadParams `json:"params,omitempty"` RemoteLocales []*phrase.Locale Format *phrase.Format }
func (*Source) CheckPreconditions ¶
func (*Source) GetFileFormat ¶
func (*Source) GetLocaleID ¶
func (*Source) LocaleFiles ¶
func (source *Source) LocaleFiles() (LocaleFiles, error)
Return all locale files from disk that match the source pattern.
type Sources ¶
type Sources []*Source
func SourcesFromConfig ¶
func (Sources) GetAllLocalesCacheKeys ¶
func (sources Sources) GetAllLocalesCacheKeys() []LocalesCacheKey
type SourcesOrTargets ¶
type SourcesOrTargets interface { // returns a list of LocalesCacheKeys (ProjectId, Branch) for all targets GetAllLocalesCacheKeys() []LocalesCacheKey }
type SourcesYAML ¶
type Target ¶
type Target struct { File string `json:"file"` ProjectID string `json:"project_id"` AccessToken string `json:"access_token"` FileFormat string `json:"file_format"` Params *PullParams `json:"params" mapstructure:"omittable-nested,omitempty"` RemoteLocales []*phrase.Locale }
func (*Target) CheckPreconditions ¶
func (*Target) DownloadAndWriteToFile ¶
func (target *Target) DownloadAndWriteToFile(client *phrase.APIClient, localeFile *LocaleFile, async bool) error
func (*Target) GetLocaleID ¶
func (*Target) LocaleFiles ¶
func (target *Target) LocaleFiles() (LocaleFiles, error)
func (*Target) ReplacePlaceholders ¶
func (target *Target) ReplacePlaceholders(localeFile *LocaleFile) (string, error)
type Targets ¶
type Targets []*Target
func TargetsFromConfig ¶
func (Targets) GetAllLocalesCacheKeys ¶
func (targets Targets) GetAllLocalesCacheKeys() []LocalesCacheKey
type TargetsYAML ¶
type TargetsYAML SourcesYAML
type UploadCleanupCommand ¶
type UploadCleanupCommand struct { phrase.Config IDs []string ProjectID string Confirm bool Branch string }
func (*UploadCleanupCommand) Run ¶
func (cmd *UploadCleanupCommand) Run() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.