Class CrowdinAPIHelper

java.lang.Object
org.exoplatform.crowdin.utils.CrowdinAPIHelper

public class CrowdinAPIHelper extends Object
  • Constructor Details

  • Method Details

    • addDirectory

      public String addDirectory(String _dirName) throws org.apache.maven.plugin.MojoExecutionException
      Calls the function http://crowdin.com/page/api/add-directory
      Parameters:
      _dirName - the name of the directory to create (with path if the directory is nested)
      Returns:
      true if the request is successful (directory created), false otherwise
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • addFile

      public String addFile(CrowdinFile _file) throws org.apache.maven.plugin.MojoExecutionException
      Calls the function https://crowdin.com/page/api/add-file
      Parameters:
      _file - the full path + name of the file
      Returns:
      true if the request is successful (file added), false otherwise
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • deleteFile

      public String deleteFile(CrowdinFile _file) throws org.apache.maven.plugin.MojoExecutionException
      Calls the function https://crowdin.com/page/api/delete-file
      Parameters:
      _file - Crowdin file
      Returns:
      true if the request is successful (file deleted), false otherwise
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • elementExists

      public boolean elementExists(String _eltPath) throws org.apache.maven.plugin.MojoExecutionException
      Parameters:
      _eltPath - the full path of the file/folder to check
      Returns:
      true if the element exists, false otherwise
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • updateFile

      public String updateFile(CrowdinFile _file) throws org.apache.maven.plugin.MojoExecutionException
      Calls the function https://crowdin.com/page/api/update-file
      Parameters:
      _file - the full path + name of the file
      Returns:
      true if the request is successful (file updated), false otherwise
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • uploadTranslation

      public String uploadTranslation(CrowdinTranslation _file, boolean autoApprovedImported) throws org.apache.maven.plugin.MojoExecutionException
      Calls the function https://crowdin.com/page/api/upload-translation
      Parameters:
      _file - the full path + name of the translation file
      Returns:
      true if the request is successful (translation uploaded), false otherwise
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getProjectInfo

      public String getProjectInfo() throws org.apache.maven.plugin.MojoExecutionException
      Calls the function https://crowdin.com/page/api/info
      Returns:
      an XML string with all information about this project
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • downloadTranslations

      public void downloadTranslations(File translationsFile) throws org.apache.maven.plugin.MojoExecutionException, FileNotFoundException, IOException
      Parameters:
      translationsFile - the File that contains all translations if the request is successful, null otherwise
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      FileNotFoundException
      IOException
    • setApprovedOnlyOption

      public String setApprovedOnlyOption() throws org.apache.maven.plugin.MojoExecutionException
      Calls the function https://crowdin.com/page/api/edit-project
      Returns:
      an XML string with all information about the result
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getTranslationStatus

      public String getTranslationStatus() throws org.apache.maven.plugin.MojoExecutionException
      Calls the function https://crowdin.com/page/api/edit-project
      Returns:
      an XML string with the status of translations
      Throws:
      org.apache.maven.plugin.MojoExecutionException