Class TransifexClient


  • public class TransifexClient
    extends Object
    Basic Transifex client allowing to create and maintain Transifex project from a java application.
    • 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()
      • setCredentials

        public void setCredentials​(String username,
                                   String password)
      • 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.
      • 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.