Package net.sf.okapi.lib.transifex
Class TransifexClient
- java.lang.Object
-
- net.sf.okapi.lib.transifex.TransifexClient
-
public class TransifexClient extends Object
Basic Transifex client allowing to create and maintain Transifex project from a java application.
-
-
Constructor Summary
Constructors Constructor Description TransifexClient(String host)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String[]createProject(String projectId, String name, String shortDescription, String longDescription)Deprecated.String[]createProject(String projectId, String name, String shortDescription, LocaleId srcLoc, boolean isPrivate, String projectURL)Creates an open-source project new project if one does not exists already.StringgetHost()Object[]getInformation(String resId, LocaleId locId)Gets information about a given resource for a given locale.StringgetProject()String[]getResource(String resourceId, LocaleId trgLoc, String outputPath)Pulls a resource from the current project.Object[]getResourceList(LocaleId srcLoc)Retrieves the list of the resources for the current project, for a given source locale.String[]putSourceResource(String poPath, LocaleId srcLoc, String resourceFile)Add a resource to the current project.String[]putTargetResource(String poPath, LocaleId trgLoc, String resourceSlug, String resourceFile)String[]putTargetResourceV2(String poPath, LocaleId trgLoc, String resourceSlug, String resourceFile)voidsetCredentials(String username, String password)voidsetHost(String host)voidsetProject(String project)
-
-
-
Constructor Detail
-
TransifexClient
public TransifexClient(String host)
-
-
Method Detail
-
setHost
public void setHost(String host)
-
getHost
public String getHost()
-
setProject
public void setProject(String project)
-
getProject
public String getProject()
-
createProject
@Deprecated public String[] createProject(String projectId, String name, String shortDescription, String longDescription)
Deprecated.Creates a new project if one does not exists already. If the project exists already it is updated. This is for the v1 API, usecreateProject(String, String, String, LocaleId, boolean, String)instead.- Parameters:
projectId- the project Id.name- the name of the project.shortDescription- a short description (can be null).longDescription- a longer description (can be null).- Returns:
- an array of strings: On success 0=the project id. On error 0=null, 1=Error code and message.
-
createProject
public String[] createProject(String projectId, String name, String shortDescription, LocaleId srcLoc, boolean isPrivate, String projectURL)
Creates an open-source project new project if one does not exists already. If the project exists already it is updated.- Parameters:
projectId- the project Id.name- the name of the project.shortDescription- a short description (can be null).srcLoc- source locale.isPrivate- true for a private project, false for a public one.projectURL- the URL of the project (mandatory for FOSS projects)- Returns:
- an array of strings: On success 0=the project id. On error 0=null, 1=Error code and message.
-
putSourceResource
public String[] putSourceResource(String poPath, LocaleId srcLoc, String resourceFile)
Add a resource to the current project. If the resource exists already it is updated.- Parameters:
poPath- the full path of the PO file to add.srcLoc- the locale of the source text.resourceFile- filename of the resource (must be the same for all languages) or null to use the filename of the path.- Returns:
- An array of strings: On success 0=redirect path, 1=resource Id. On error: 0=null, 1=Error code and message.
-
putTargetResource
public String[] putTargetResource(String poPath, LocaleId trgLoc, String resourceSlug, String resourceFile)
-
putTargetResourceV2
public String[] putTargetResourceV2(String poPath, LocaleId trgLoc, String resourceSlug, String resourceFile)
-
getResource
public String[] getResource(String resourceId, LocaleId trgLoc, String outputPath)
Pulls a resource from the current project.- Parameters:
resourceId- the id of the resource to pull.trgLoc- the target locale of the resource to pull.outputPath- the output path of the resulting PO file.- Returns:
- an array of strings: On success 0=the output path, 1=the resource id. On error 0=null, 1=the code and error message.
-
getInformation
public Object[] getInformation(String resId, LocaleId locId)
Gets information about a given resource for a given locale.- Parameters:
resId- the identifier of the resource.locId- the locale identifier- Returns:
- an array of two objects: On success 0=date 1=completion, On error: 0=null, 1=null.
-
getResourceList
public Object[] getResourceList(LocaleId srcLoc)
Retrieves the list of the resources for the current project, for a given source locale.- Parameters:
srcLoc- the source locale.- Returns:
- an array of object. On success: 0=project id, 1=project short description, 2=a map of the resource (id and name). On error: 0=null, 1=Error message.
-
-