Constructor
new Project(param)
- Source:
All of responses from the server will be sent through the events.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
param |
Object | The options for Project. most of the properties will be stored into module:zanata/config~Config. Properties
|
Extends
- EventEmitter
Methods
create(paramsopt)
- Source:
- See:
Create a project
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object |
<optional> |
the parameters to create a project. most properties will be stored into module:zanata/config~Config. Properties
|
Fires:
createVersion(projectId, versionId, params)
- Source:
- See:
Create a version in the project.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
||||||
versionId |
string | the version id |
||||||
params |
object | the parameters to create a version. most properties will be stored into module:zanata/config~Config. Properties
|
Fires:
info(id, containLocales)
- Source:
Obtain the project information from the Zanata.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the project id to obtain the information |
containLocales |
boolean | true to contain the locale information in the result, otherwise will be suppressed. |
Fires:
list(filteropt)
- Source:
Obtain the projects and the information available on the Zanata
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filter |
Array.<string> |
<optional> |
['id', 'name', 'status']
|
The properties you want to obtain from the project. |
Fires:
pull(params)
- Source:
Pull the documents from the Zanata
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | the parameters to pull the documents from the Zanata Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:warning
- module:zanata/project~Project#event:data_pull
- module:zanata/project~Project#event:end_pull
pullSource(projectId, versionId, docId, paramsopt)
- Source:
Pull the source document from the Zanata
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
|||||||||||||||||||||
versionId |
string | the version id |
|||||||||||||||||||||
docId |
string | the document id |
|||||||||||||||||||||
params |
object |
<optional> |
the parameters to pull the source document Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:warning
- module:zanata/project~Project#event:data_pull
- module:zanata/project~Project#event:end_pull
pullSources(projectId, versionId, params)
- Source:
Pull the source documents from the Zanata
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
||||||||||||||||||||
versionId |
string | the project version id |
||||||||||||||||||||
params |
object | the parameters to pull the source documents from the Zanata Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:warning
- module:zanata/project~Project#event:data_pull
- module:zanata/project~Project#event:end_pull
pullTranslation(projectId, versionId, docId, locales, params)
- Source:
Pull the translated document from the Zanata
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
||||||||||||||||||||||||||||||
versionId |
string | the project version id |
||||||||||||||||||||||||||||||
docId |
string | the document id |
||||||||||||||||||||||||||||||
locales |
Array.<string> | string | the locales you want to pull the translations |
||||||||||||||||||||||||||||||
params |
object | the parameters to pull the translated document from the Zanata Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:warning
- module:zanata/project~Project#event:data_pull
- module:zanata/project~Project#event:end_pull
pullTranslations(projectId, versionId, locales, params)
- Source:
Pull the translated documents from the Zanata
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
||||||||||||||||||||||||||||||
versionId |
string | the project version id |
||||||||||||||||||||||||||||||
locales |
Array.<string> | string | the locales you want to pull the translations |
||||||||||||||||||||||||||||||
params |
object | the parameters to pull the translated document from the Zanata Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:warning
- module:zanata/project~Project#event:data_pull
- module:zanata/project~Project#event:end_pull
push(paramsopt)
- Source:
Push the documents to the Zanata
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object |
<optional> |
the parameters to push the documents Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:warning
- module:zanata/project~Project#event:data_push
- module:zanata/project~Project#event:end_push
pushSource(projectId, versionId, file, paramsopt)
- Source:
Push the source document to the Zanata
Parameters:
Name | Type | Attributes | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
|||||||||||
versionId |
string | the project version id |
|||||||||||
file |
string | the filename which you want to push as the source document |
|||||||||||
params |
object |
<optional> |
the parameters to push the source document Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:data_push
- module:zanata/project~Project#event:end_push
pushSources(projectId, versionId, paramsopt)
- Source:
Push the source documents to the Zanata
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
|||||||||||||||||||||
versionId |
string | the project version id |
|||||||||||||||||||||
params |
object |
<optional> |
the parameters to push the source document Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:data_push
- module:zanata/project~Project#event:end_push
pushTranslation(projectId, versionId, docId, locale, file, paramsopt)
- Source:
Push the translated document to the Zanata
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
||||||||||||||||
versionId |
string | the project version id |
||||||||||||||||
docId |
string | the document id |
||||||||||||||||
locale |
string | the locale name pushing the document |
||||||||||||||||
file |
string | the filename which you want to push as the translated document |
||||||||||||||||
params |
object |
<optional> |
the parameters to push the translated document Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:data_push
- module:zanata/project~Project#event:end_push
pushTranslations(projectId, versionId, locales, paramsopt)
- Source:
Push the translated documents to the Zanata
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
||||||||||||||||||||||||||||||||||||
versionId |
string | the project version id |
||||||||||||||||||||||||||||||||||||
locales |
Array.<string> | the locale name pushing the documents |
||||||||||||||||||||||||||||||||||||
params |
object |
<optional> |
the parameters to push the translated documents Properties
|
Fires:
- module:zanata/project~Project#event:fail
- module:zanata/project~Project#event:warning
- module:zanata/project~Project#event:data_push
- module:zanata/project~Project#event:end_push
stats(projectId, versionId, docIdopt, paramsopt)
- Source:
Obtain document statistics from the Zanata
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | the project id |
|||||||||||||||||||||
versionId |
string | the project version id |
|||||||||||||||||||||
docId |
string |
<optional> |
the document id |
||||||||||||||||||||
params |
object |
<optional> |
the parameters to obtain the document statistics Properties
|
Fires:
versionInfo(projectId, versionId, containLocales)
- Source:
Obtain the information about the version for the project
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | the project id |
versionId |
string | the version id |
containLocales |
boolean | true to contain the locale information in the result, otherwise will be suppressed. |
Fires:
Events
data_create
- Source:
data event from create method. this contains the result string.
Type:
- string
data_info
- Source:
- See:
Properties:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string | the project id |
|||||||||||||||||||||||||||||||||||||||
defaultType |
string | the default project type |
|||||||||||||||||||||||||||||||||||||||
name |
string | the project name |
|||||||||||||||||||||||||||||||||||||||
status |
string | the project status |
|||||||||||||||||||||||||||||||||||||||
description |
string | the project description |
|||||||||||||||||||||||||||||||||||||||
sourceViewURL |
string | the source view URL for the project |
|||||||||||||||||||||||||||||||||||||||
sourceCheckoutURL |
string | the source URL to check out |
|||||||||||||||||||||||||||||||||||||||
versions |
Array.<object> | the version-related information Properties
|
|||||||||||||||||||||||||||||||||||||||
locales |
Array.<object> |
<optional> |
the locale name available in this project Properties
|
data event from info method.
Type:
- object
data_list
- Source:
- See:
Properties:
Name | Type | Description |
---|---|---|
id |
string | the project id |
defaultType |
string | the default project type |
name |
string | the project name |
status |
string | the project status |
description |
string | the project description |
sourceViewURL |
string | the source view URL for the project |
sourceCheckoutURL |
string | the source URL to check out |
data event from list method
Type:
- Array.<object>
data_pull
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | the document id |
|
type |
string | the document type. 'pot' for the source document and 'po' for the translation |
|
data |
string | the contents for POT file |
|
locale |
string |
<optional> |
the locale name for document. this is only available when pulling translations |
data event from pull methods. this is emitted when any data is received from the Zanata on pulling.
Type:
- object
data_push
- Source:
data event from push methods. this event is emitted after pushing data to the Zanata. the passed data contains the filename that pushed to the Zanata.
Type:
- string
data_stats
- Source:
- See:
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string | |||||||||||||||||||||||||||||||||||||
stats |
Array.<object> |
Properties
|
||||||||||||||||||||||||||||||||||||
detailedStats |
Array.<object> |
data event from stats method
Type:
- object
data_version_info
- Source:
- See:
Properties:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string | the version id |
|||||||||||||||||||||||||||||||||||||||
status |
string | the status |
|||||||||||||||||||||||||||||||||||||||
projectType |
string | the project type |
|||||||||||||||||||||||||||||||||||||||
locales |
Array.<object> |
<optional> |
the locale name available in this project Properties
|
data event from versionInfo method.
Type:
- object
end_pull
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | the document id |
|
type |
string | the document type. 'pot' for the source document and 'po' for the translation |
|
pulled |
boolean | whether the document was actually pulled from the Zanata or the cache due to no changes since the last pull. |
|
locale |
string |
<optional> |
the locale name for document. this is only available when pulling translations |
end event for pull methods. this is emitted when all of pulling is finished.
Type:
- Array.<object>
end_push
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
docId |
string | the document id |
|
type |
string | the document type pushed. 'pot' for the source document and 'po' for the translated document |
|
file |
string | the finename pushed to the Zanata. |
|
locale |
string |
<optional> |
the locale name pushed to the Zanata. this property is only available when pushing the translated document |
end event from push methods. this event is emitted when all of pushing is finished.
Type:
- Array.<object>
fail
- Source:
fail event
Type:
- Error
warning
- Source:
warning event from pull/push methods. this contains the warning messages where happened during processing and not that important more than stopping.
Type:
- string