Documentation ¶
Index ¶
- type APIError
- type AccountDetails
- type AddFileOptions
- type ChangeDirectoryOptions
- type CreateProjectOptions
- type Crowdin
- func (crowdin *Crowdin) AddDirectory(directoryName string) (*responseGeneral, error)
- func (crowdin *Crowdin) AddFile(options *AddFileOptions) (*responseAddFile, error)
- func (crowdin *Crowdin) ChangeDirectory(options *ChangeDirectoryOptions) (*responseGeneral, error)
- func (crowdin *Crowdin) CreateProject(accountKey, loginUsername string, options *CreateProjectOptions) (*responseManageProject, error)
- func (crowdin *Crowdin) DeleteDirectory(directoryName string) (*responseGeneral, error)
- func (crowdin *Crowdin) DeleteFile(fileName string) (*responseGeneral, error)
- func (crowdin *Crowdin) DeleteProject() (*responseDeleteProject, error)
- func (crowdin *Crowdin) DownloadTranslations(options *DownloadOptions) error
- func (crowdin *Crowdin) EditProject(options *EditProjectOptions) (*responseManageProject, error)
- func (crowdin *Crowdin) ExportFile(options *ExportFileOptions) error
- func (crowdin *Crowdin) ExportTranslations() (*responseExportTranslations, error)
- func (crowdin *Crowdin) GetAccountProjects(accountKey, loginUsername string) (*AccountDetails, error)
- func (crowdin *Crowdin) GetExportStatus() (*ExportStatus, error)
- func (crowdin *Crowdin) GetLanguageStatus(languageCode string) (*responseLanguageStatus, error)
- func (crowdin *Crowdin) GetProjectDetails() (*ProjectInfo, error)
- func (crowdin *Crowdin) GetTranslationsStatus() ([]TranslationStatus, error)
- func (crowdin *Crowdin) SetClient(client *http.Client)
- func (crowdin *Crowdin) SetDebug(debug bool, logWriter io.Writer)
- func (crowdin *Crowdin) SetProject(token, project string) *Crowdin
- func (crowdin *Crowdin) UpdateFile(options *UpdateFileOptions) (*responseGeneral, error)
- func (crowdin *Crowdin) UploadTranslations(options *UploadTranslationsOptions) (*responseUploadTranslation, error)
- type DownloadOptions
- type EditProjectOptions
- type ExportFileOptions
- type ExportStatus
- type ProjectInfo
- type TranslationStatus
- type UpdateFileOptions
- type UploadTranslationsOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
What string
}
APIError holds data of errors returned from the API.
type AccountDetails ¶
type AccountDetails struct { Success bool `json:"success"` Projects []struct { Role string `json:"role"` Name string `json:"name"` Identifier string `json:"identifier"` Downloadable int `json:"downloadable"` Key string `json:"key"` } `json:"projects"` }
AccountDetails is a response struct
type AddFileOptions ¶
type AddFileOptions struct { // Note: Used only when uploading CSV (or XLS/XLSX) file to define data columns mapping. // Acceptable value is the combination of the following constants: // "identifier" — Column contains string identifier. // "source_phrase" — Column contains only source string (in result string will contain same string). // "source_or_translation" — Column contains source string but when exporting same column should contain translation (also when uploading existing translations, the value from this column will be used as a translated string). // "translation" — Column contains translated string (when imported file already contains translations). // "context" — Column contains some comments on source string. Context information. // "max_length" — Column contains max. length of translation for this string. // "none" — Do not import column. Scheme string // Used when uploading CSV (or XLS/XLSX) files via API. Defines whether first line should be imported or it contains columns headers. May not contain value. FirstLineContainsHeader bool // Files array that should be added to Crowdin project. Array keys should contain file names with path in Crowdin project. Files map[string]string // Acceptable values are: // empty value or "auto" — Try to detect file type by extension or MIME type // "gettext" — GNU GetText (*.po, *.pot) // "qtts" — Nokia Qt (*.ts) // "dklang" — Delphi DKLang (*.dklang) // "android" — Android (*.xml) // "resx" — .NET (*.resx) // "properties" — Java (*.properties) // "macosx" — Mac OS X / iOS (*.strings) // "blackberry" — BlackBerry (*.rrc) // "Symbian" — Symbian (*.lXX) // "flex" — Adobe Flex (*.properties) // "bada" — Samsung Bada (*.xml) // "txt" — Plain Text (*.txt) // "srt" — SubRip .srt (*.srt) // "sbv" — Youtube .sbv (*.sbv) // "xliff" — XLIFF (*.xliff) // "html" — HTML (*.html, *.htm, *.xhtml, *.xhtm) // "dtd" — Mozilla DTD (*.dtd) // "chrome" — Google Chrome Extension (*.json) // "yaml" — Ruby On Rails (*.yaml) // "csv" — Comma Separated Values (*.csv) // "rc" — Windows Resources (*.rc) // "wxl" — WiX Installer Resources (*.wxl) // "nsh" — NSIS Installer Resources (*.nsh) // "joomla" — Joomla localizable resources (*.ini) // "ini" — Generic INI (*.ini) // "isl" — ISL (*.isl) // "resw" — Windows 8 Metro (*.resw) // "resjson" — Windows 8 Metro (*.resjson) // "docx" — Microsoft Office and OpenOffice.org Documents (*.docx, *.dotx, *.odt, *.ott, *.xslx, *.xltx, *.pptx, *.potx, *.ods, *.ots, *.odg, *.otg, *.odp, *.otp, *.idml) // "md" — Markdown (*.md, *.text, *.markdown...) // "mediawiki" — MediaWiki (*.wiki, *.wikitext, *.mediawiki) // "play" — Play Framework // "haml" — Haml (*.haml) // "arb" — Application Resource Bundle (*.arb) // "vtt" — Video Subtitling and WebVTT (*.vtt) Type string }
AddFileOptions used for AddFile() API call
type ChangeDirectoryOptions ¶
type ChangeDirectoryOptions struct { // Full directory path that should be modified (e.g. /MainPage/AboutUs). Name string // New directory name. NewName string // New directory title to be displayed in Crowdin UI. Title string }
ChangeDirectoryOptions are options for ChangeDirectory api call
type CreateProjectOptions ¶
type CreateProjectOptions struct { // Project name. Name string // Project identifier. Should be unique among other Crowdin projects. Identifier string // Source files language. Should be a two letters language code. SourceLanguage string // An array of language codes project should be translate to. Languages []string // Project join policy. Acceptable values are: open, private JoinPolicy string }
CreateProjectOptions are options for CreateProject api call
type Crowdin ¶
type Crowdin struct {
// contains filtered or unexported fields
}
Crowdin API wrapper
func (*Crowdin) AddDirectory ¶
AddDirectory - Add directory to Crowdin project. name - Directory name (with path if nested directory should be created).
func (*Crowdin) AddFile ¶
func (crowdin *Crowdin) AddFile(options *AddFileOptions) (*responseAddFile, error)
AddFile - Add new file to Crowdin project.
func (*Crowdin) ChangeDirectory ¶
func (crowdin *Crowdin) ChangeDirectory(options *ChangeDirectoryOptions) (*responseGeneral, error)
ChangeDirectory - Rename directory or modify its attributes. When renaming directory the path can not be changed (it means new_name parameter can not contain path, name only).
func (*Crowdin) CreateProject ¶
func (crowdin *Crowdin) CreateProject(accountKey, loginUsername string, options *CreateProjectOptions) (*responseManageProject, error)
CreateProject - Create Crowdin project.
func (*Crowdin) DeleteDirectory ¶
DeleteDirectory - Delete Crowdin project directory. All nested files and directories will be deleted too. name - Directory name (with path if nested directory should be created).
func (*Crowdin) DeleteFile ¶
DeleteFile - Delete file from Crowdin project. All the translations will be lost without ability to restore them
func (*Crowdin) DeleteProject ¶
DeleteProject - Delete Crowdin project with all translations.
func (*Crowdin) DownloadTranslations ¶
func (crowdin *Crowdin) DownloadTranslations(options *DownloadOptions) error
DownloadTranslations - Download ZIP file with translations. You can choose the language of translation you need or download all of them at once.
func (*Crowdin) EditProject ¶
func (crowdin *Crowdin) EditProject(options *EditProjectOptions) (*responseManageProject, error)
EditProject - Edit Crowdin project.
func (*Crowdin) ExportFile ¶
func (crowdin *Crowdin) ExportFile(options *ExportFileOptions) error
ExportFile - This method exports single translated files from Crowdin. Additionally, it can be applied to export XLIFF files for offline localization.
func (*Crowdin) ExportTranslations ¶
ExportTranslations - Build ZIP archive with the latest translations. Please note that this method can be invoked only once per 30 minutes (there is no such restriction for organization plans). Also API call will be ignored if there were no changes in the project since previous export. You can see whether ZIP archive with latest translations was actually build by status attribute ("built" or "skipped") returned in response.
func (*Crowdin) GetAccountProjects ¶
func (crowdin *Crowdin) GetAccountProjects(accountKey, loginUsername string) (*AccountDetails, error)
GetAccountProjects - Get Crowdin Project details.
func (*Crowdin) GetExportStatus ¶
func (crowdin *Crowdin) GetExportStatus() (*ExportStatus, error)
GetExportStatus - Get the status of translations export
func (*Crowdin) GetLanguageStatus ¶
GetLanguageStatus - Get the detailed translation progress for specified language. Language codes - https://crowdin.com/page/api/language-codes
func (*Crowdin) GetProjectDetails ¶
func (crowdin *Crowdin) GetProjectDetails() (*ProjectInfo, error)
GetProjectDetails - Get Crowdin Project details
func (*Crowdin) GetTranslationsStatus ¶
func (crowdin *Crowdin) GetTranslationsStatus() ([]TranslationStatus, error)
GetTranslationsStatus - Track overall translation and proofreading progresses of each target language
func (*Crowdin) SetProject ¶
SetProject set project details
func (*Crowdin) UpdateFile ¶
func (crowdin *Crowdin) UpdateFile(options *UpdateFileOptions) (*responseGeneral, error)
UpdateFile - Upload latest version of your localization file to Crowdin
func (*Crowdin) UploadTranslations ¶
func (crowdin *Crowdin) UploadTranslations(options *UploadTranslationsOptions) (*responseUploadTranslation, error)
UploadTranslations - Upload latest version of your localization file to Crowdin
type DownloadOptions ¶
type DownloadOptions struct { // Language code or "all" to download a bundle with translations to all languages. Package string // Path to the file name that file will be exported to. LocalPath string }
DownloadOptions are options for DownloadTranslations api call
type EditProjectOptions ¶
type EditProjectOptions struct { // Project name. Name string // An array of language codes project should be translate to. Languages []string // Project join policy. Acceptable values are: open, private JoinPolicy string }
EditProjectOptions are options for EditProject api call
type ExportFileOptions ¶
type ExportFileOptions struct { // This parameter specifies a path to the file that should be exported from the project. CrowdinFile string // Crowdin language code. Language string // Path to the file name that file will be exported to. LocalPath string }
ExportFileOptions are options for ExportFile api call
type ExportStatus ¶
type ExportStatus struct { Status string `json:"status"` Progress int `json:"progress"` LastBuild string `json:"last_build"` Code string `json:"code"` Message string `json:"message"` CurrentFile string `json:"current_file"` CurrentLanguage string `json:"current_language"` }
ExportStatus is a response struct
type ProjectInfo ¶
type ProjectInfo struct { Files []struct { Name string `json:"name"` NodeType string `json:"node_type"` Created string `json:"created"` LastUpdated string `json:"last_updated"` LastAccessed string `json:"last_accessed"` LastRevision string `json:"last_revision"` } `json:"files"` Language struct { Name string `json:"name"` Code string `json:"code"` CanTranslate int `json:"can_translate"` CanApprove int `json:"can_approve"` } Details struct { SourceLanguage struct { Name string `json:"name"` Code string `json:"code"` } `json:"source_language"` Name string `json:"name"` Identifier string `json:"identifier"` Created string `json:"created"` Description string `json:"description"` JoinPolicy string `json:"private"` LastBuild string `json:"last_build"` LastActivity string `json:"last_activity"` ParticipantsCount string `json:"participants_count"` TotalStringsCount string `json:"total_strings_count"` TotalWordsCount string `json:"total_words_count"` DuplicateStringsCount int `json:"duplicate_strings_count"` DuplicateWordsCount int `json:"duplicate_words_count"` InviteURL struct { Translator string `json:"translator"` Proofreader string `json:"proofreader"` } `json:"invite_url"` } `json:"details"` }
ProjectInfo is a response struct
type TranslationStatus ¶
type TranslationStatus struct { Name string `json:"name"` Code string `json:"code"` Phrases string `json:"phrases"` Translated string `json:"translated"` Approved string `json:"approved"` Words string `json:"words"` WordsTranslated string `json:"words_translated"` WordsApproved string `json:"words_approved"` TranslatedProgress int `json:"translated_progress"` ApprovedProgress int `json:"approved_progress"` }
TranslationStatus is a response struct
type UpdateFileOptions ¶
type UpdateFileOptions struct { // Note: Used only when uploading CSV (or XLS/XLSX) file to define data columns mapping. // Acceptable value is the combination of the following constants: // "identifier" — Column contains string identifier. // "source_phrase" — Column contains only source string (in result string will contain same string). // "source_or_translation" — Column contains source string but when exporting same column should contain translation (also when uploading existing translations, the value from this column will be used as a translated string). // "translation" — Column contains translated string (when imported file already contains translations). // "context" — Column contains some comments on source string. Context information. // "max_length" — Column contains max. length of translation for this string. // "none" — Do not import column. Scheme string // Used when uploading CSV (or XLS/XLSX) files via API. Defines whether first line should be imported or it contains columns headers. May not contain value. FirstLineContainsHeader bool // Files array that should be added to Crowdin project. Array keys should contain file names with path in Crowdin project. Files map[string]string }
UpdateFileOptions used for UpdateFile() API call
type UploadTranslationsOptions ¶
type UploadTranslationsOptions struct { // Target language. With a single call it's possible to upload translations for several files but only into one of the languages. Language string // Translated files array. Array keys should contain file names in Crowdin. Files map[string]string // Defines whether to add translation if there is the same translation previously added. Acceptable values are: 0 or 1. Default is 0. ImportDuplicates string }
UploadTranslationsOptions are options for UploadTranslations api call