Documentation ¶
Overview ¶
Package cli allows the user to create a PhraseApp cli app.
The cli app has 4 commands:
init Initializes a phrase project pull Download the translation files in the current project push Upload the translation files in the current project to PhraseApp tags List all the tags in the current project
The cli implements all the commands and subcommands implemented by the official PhraseApp command-line client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Project auth token. You can find the auth token in your project overview or project settings form. Secret string `json:"secret"` // Default locale your PhraseApp project (default is en). DefaultLocale string `json:"default_locale"` // Set a domain for use with Gettext translation files (default is phrase). Domain string `json:"domain,omitempty"` // Specify a format that should be used as the default format when downloading files (default is yml). Format string `json:"format,omitempty"` // Set the target directly to store your localization files retrieved by phrase pull. Allows placeholders: https://github.com/phrase/phrase#allowed-placeholders-for-advanced-configuration TargetDirectory string `json:"target_directory,omitempty"` // Set the directory that contains your source locales (used by the go-phrase push command). Allows placeholders: https://github.com/phrase/phrase#allowed-placeholders-for-advanced-configuration LocaleDirectory string `json:"locale_directory,omitempty"` // Set the filename for files you download from PhraseApp via phrase pull. Allows placeholders: https://github.com/phrase/phrase#allowed-placeholders-for-advanced-configuration LocaleFilename string `json:"locale_filename,omitempty"` // Set the encoding for your localization files to UTF-8, UTF-16 or Latin-1. Please note that the encodings only work for a handful of formats like IOS .strings or Java .properties. The default will be UTF-8. If none is provided the default encoding of the formats is used. Encoding string `json:"encoding,omitempty"` // contains filtered or unexported fields }
Config stores the default values for some of the properties of the PhraseApp API client
func NewConfig ¶
NewConfig returns a Config instance. Its properties will be populated from the file found in the path argument (assumed to be in a certain JSON format), and some properties will have default values assigned.
func (*Config) ForLocale ¶
func (c *Config) ForLocale(l *phrase.Locale) *LocaleConfig
ForLocale returns a LocaleConfig for the given Locale.
type InitCommand ¶
InitCommand will initialize a PhraseApp config file named .phrase in the current directory.
func (*InitCommand) Help ¶
func (c *InitCommand) Help() string
Help displays available options for the init command.
func (*InitCommand) Run ¶
func (c *InitCommand) Run(args []string) int
Run executes the init command.
func (*InitCommand) Synopsis ¶
func (c *InitCommand) Synopsis() string
Synopsis displays a synopsis of the init command.
type LocaleConfig ¶
type LocaleConfig struct { Config // contains filtered or unexported fields }
LocaleConfig stores locale specific configuration options
type PullCommand ¶
PullCommand will download locale files from PhraseApp.
func (*PullCommand) Help ¶
func (c *PullCommand) Help() string
Help displays available options for the pull command.
func (*PullCommand) Run ¶
func (c *PullCommand) Run(args []string) int
Run executes the pull command.
func (*PullCommand) Synopsis ¶
func (c *PullCommand) Synopsis() string
Synopsis displays a synopsis of the pull command.
type PushCommand ¶
PushCommand will upload locale files to PhraseApp.
func (*PushCommand) Help ¶
func (c *PushCommand) Help() string
Help displays available options for the push command.
func (*PushCommand) Run ¶
func (c *PushCommand) Run(args []string) int
Run executes the push command.
func (*PushCommand) Synopsis ¶
func (c *PushCommand) Synopsis() string
Synopsis displays a synopsis of the push command.
type TagsCommand ¶
TagsCommand will display all tags in the current project.
func (*TagsCommand) Help ¶
func (c *TagsCommand) Help() string
Help displays available options for the tags command.
func (*TagsCommand) Run ¶
func (c *TagsCommand) Run(args []string) int
Run executes the tags command.
func (*TagsCommand) Synopsis ¶
func (c *TagsCommand) Synopsis() string
Synopsis displays a synopsis of the tags command.