Coder Social home page Coder Social logo

crowdin-java-sdk's Introduction

Crowdin API Java SDK

A Java library to access Crowdin API.

Crowdin provides RESTful API with XML or JSON over HTTP using GET or POST methods. With a help of this SDK you can smooth the work with all Crowdin API methods in your Java project, such as adding and updating files, downloading translations or integrating localization with your development process.

Prerequisites

  • Java JDK 7 or newest
  • Gradle

Quick start

  • Clone the repo
git clone https://github.com/crowdin/crowdin-java-sdk.git
  • Refresh project's dependencies using gradle
  • Build the project to get jar file :
gradle buildJavaSdkJar
  • Add this file to your project

Acquiring and Using an API Key

To find your project API key you have to:

  1. Login to your Crowdin account

  2. Select necessary project

  3. Go to the Project Settings, API tab

Settings API

Making First Call

Once you have completed the Installation, we could make the first call:

  • Create variables for API key, project identifier, account key, base url and save their values
public static final String  BASE_URL = "https://api.crowdin.com/api/";
public static final String  PROJECT_IDENTIFIER = "your-project-identifier";
public static final String  PROJECT_KEY = "your-project-key";
public static final String  ACCOUNT_KEY = "your-account-key";
  • Create a Credentials object with proper configurations
Credentials credentials = new Credentials(BASE_URL, PROJECT_IDENTIFIER, PROJECT_KEY, ACCOUNT_KEY);
CrowdinApiParametersBuilder parameters = new CrowdinApiParametersBuilder();
parameters.json();
  • Create CrowdinApiClient object and choose the necessory API method
CrowdinApiClient crwdn = new Crwdn();
crwdn.getInfo(credentials, parameters);

For output the response's entity:

System.out.println(crwdn.getInfo(credentials, parameters).getEntity(String.class));
  • Run the code using IDE or command line. It should return something like this:
{
  "languages":[...],
  "files":[...],
  "details":{
    "source_language":{
      "name":"Ukrainian",
      "code":"uk"
    },
    "name":"crowdin2",
    "identifier":"crowdin2",
    "created":"2016-11-09 07:20:33",
    "description":"",
    "join_policy":"private",
    "last_build":"2016-12-07 10:00:27",
    "last_activity":"2016-12-16 08:53:32",
    "participants_count":"1",
    "total_strings_count":"24",
    "total_words_count":"24",
    "duplicate_strings_count":22,
    "duplicate_words_count":22,
    "invite_url":{
      "translator":"https:\/\/crowdin.com\/project\/crowdin2\/invite?d=b555o4i6o6f5h5b3m4c333453",
      "proofreader":"https:\/\/crowdin.com\/project\/crowdin2\/invite?d=755565j6b6f5h5b3m4c3455323"
    }
  }
}

Bug tracker

Have a bug? Please create an issue here on GitHub

License and Author

Ihor Popyk ([email protected])

https://github.com/ihor-popyk

Copyright: 2017 crowdin.com

This project is licensed under the MIT license, a copy of which can be found in the LICENSE file.

crowdin-java-sdk's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.