Git Product home page Git Product logo

google-translate-free's Introduction

Google Translate Free

This repository is a robust translation service designed to help you with a variety of language-based features including direct translations, alternate translations, definitions, examples, transliterations, spelling suggestions, language detection, and highly relevant keyword suggestions.

Let's read the documents before using it.

Installation

Add this line to your application's Gemfile:

gem 'google-translate-free', '~> 1.0.1'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install google-translate-free

Usage

To translate

Translate.translate('summer', :vi, :en)
# => "mùa hè"

Without third params, Google Translate will auto-detect your source language.

Translate.translate('summer', :vi)
# => "mùa hè"

For alternate Translations

Translate.alternate_translations('summer', :vi, :en)
# =>
#[
#  "mùa hè",
#  "mùa hạ",
#  "hè"
#]

Without third params, Google Translate will auto-detect your source language.

Translate.alternate_translations('summer', :vi)
# =>
#[
#  "mùa hè",
#  "mùa hạ",
#  "hè"
#]

For definitions

Translate.definitions('summer')
# =>
#[
#  {
#    :noun=>[
#      ["The warmest season of the year, in the northern hemisphere from june to august and in the southern hemisphere from december to february.", "<b>summer</b> vacation.", nil],
#      ["A horizontal bearing beam, especially one supporting joists or rafters.", nil, nil]
#    ]
#  },
#  {
#    :verb=>[
#      ["Spend the summer in a particular place.", nil, nil]
#    ]
#  }
#]

For examples

Translate.examples('summer')
# =>
#[
#  "The plant flowers in late <b>summer</b>.",
#  "The golden <b>summer</b> of her life.",
#  "A long hot <b>summer</b>.",
#  "<b>summer</b> vacation."
#]

For transliteration

Translate.transliteration('summer')
# => "ˈsəmər"

For spelling suggestions

Translate.suggest('summmer')
# => "summer"

For language detection

Translate.detection('summer')
# => ["en", 0.93254006]

For keyword suggestions

Translate.see_more('summers')
# => "summer"

Contributors

I welcome contributions to this project.

  1. Fork it.
  2. Create your feature branch (git checkout -b your-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin your-feature).
  5. Create a new pull request.

License

The gem is available as open source under the terms of the MIT License.

google-translate-free's People

Contributors

datpmt avatar

Stargazers

 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.