GithubHelp home page GithubHelp logo

vamelchenia / translate-api-bridge Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 2.0 107 KB

Processing the results of the Linguee API for further use in Translators apps

Home Page: https://github.com/imankulov/linguee-api

Java 100.00%

translate-api-bridge's Introduction

Translate-api bridge

Backend Java proxy server for Nerd Translator android app to connect it with Google Cloud APIs.

Table of Contents

Technologies

Usage

To utilize this backend Java Spring Boot proxy server for communication between your Android application and Google Cloud APIs, follow these steps:

  1. Download Source Code: Clone or download the source code repository to your local machine.

    $ git clone https://github.com/vamelchenia/translate-api-bridge.git
  2. Sensitive Properties File: Create a file named sensitive.properties in the root of the project. Add your Google Cloud credentials to this file. The credentials should be provided by Google Cloud.

    Example of sensitive.properties:

     TYPE = your_property
     PROJECT_ID = your_property
     PRIVATE_KEY_ID = your_property
     PRIVATE_KEY = your_property
     CLIENT_EMAIL = your_property
     CLIENT_ID = your_property
     AUTH_URI = your_property
     TOKEN_URI = your_property
     AUTH_PROVIDER_X509_CERT_URL = your_property
     CLIENT_X509_CERT_URL = your_property
     UNIVERSE_DOMAIN = your_property

    Replace your_property with the actual values provided by Google Cloud.

  3. Build and Run: Use your preferred Java build tool to build the project. For instance, with Maven:

    $ mvn clean install

    After a successful build, you can run the application:

    $ java -jar target/translate-api-bridge.jar
  4. Integration with Android App: In your Android application, configure the API endpoints to communicate with the deployed backend server. The available endpoints are documented using SpringDoc for easy reference.

    Endpoints:

    1. Endpoint 1 - [POST] Post text to receive it's translation:

      • Path: /translation/{originalLanguage}/{targetLanguage}
      • Description: Post a text to translate with original language and target language codes as parameters and get translation with additional data as audio and part of speech if provided as response.
      • Request:
        • Method: POST
        • Path Variable:
          • originalLanguage (String) - Original language code to translate from
          • targetLanguage (String) - Target language code to translate to
        • Parameters:
          • originalText (JSON -> RequestData) - Original language text that should be translated
      • Response:
        • HttpStatus with Translation data in JSON format
    2. Endpoint 2 - [GET] Get supported languages:

      • Path: /translation/languages
      • Description: Get a map of all supported languages with their codes.
      • Request:
        • Method: GET
      • Response:
        • HttpStatus with supported languages data in JSON format

    Ensure that your Android application makes requests to these endpoints using the appropriate HTTP methods and includes any required parameters in the request body or as path variables. The detailed documentation provided by SpringDoc makes it easy to integrate and interact with the backend API seamlessly.

    You can try all endpoint out using Springdoc UI after copy and run the application:

    http://your-host:your-port/swagger-ui/index.html
    

    Users should replace your-host with their host address and your-port with their port number. For instance:

    http://localhost:8083/swagger-ui/index.html

    In this example, localhost is the host, and 8083 is the port. Each user can substitute these values with their own, depending on how they have configured their server.

  5. Note: Ensure that the backend server is running and accessible from your Android application. You may need to adjust firewall settings or deploy the backend to a publicly accessible server.

Now, your Android application should be able to communicate seamlessly with Google Cloud APIs through the Java Spring Boot proxy server.

Development

Requirements

To install and run the project, Java v17+ is required.

How to contribute

  1. Create a fork of the Translate API bridge repository. Click on the Fork symbol at the top right corner.

  2. Clone your new fork of the repository in the terminal/CLI on your computer with the following command:

git clone https://github.com/<your-github-username>/translate-api-bridge.git
  1. Navigate to the newly created project directory:
cd translate-api-bridge
  1. Create a new local branch:
git checkout -b YourBranchName
  1. Make your changes to the source code.

  2. Stage your changes and commit:

git add <file/folder>
git commit -m "A message describing your changes"
  1. Push your local commits to the remote repository:
git push origin YourBranchName

9. Create a Pull request by switching to the Pull requests tab and clicking on New pull request button.

Project Team

translate-api-bridge's People

Contributors

electron3d avatar evgenysavonkin avatar vamelchenia avatar

Stargazers

Ilia Ivankin avatar  avatar  avatar Daniil Sitdikov avatar Igor Shadurin avatar  avatar Zufar Sunagatov avatar LexaNik avatar  avatar

Watchers

 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.