Giter VIP home page Giter VIP logo

microtranslator's Introduction

MicroTranslator

Current Version: 0.0.2

Build Status

A PHP Microservice for managing Translations in your application. You can set it up anywhere in your stack and use it to upload and download translations.


Introduction

MicroTranslator is written in PHP, and currently uses MongoDB as its storage engine. For more details, feel free to head over the article on Marco Troisi's blog. The source code is being released under the MIT Licence, which means you are free to reuse, modify and even sell your work based on it. If you do any of the above listed actions, please consider following its creator on Twitter as a way to say thanks!

Usage

Show all available locales

To see all locales available (e.g. en_GB, de_DE, af_ZA, etc.), just fire up the following request:

GET /locale

and you will get a nice JSON response that looks like this:

{"items":
    [{
        "_id":{"$id":"552384e6e02f4fe237c925d0"},
        "locale":"de_DE"
    }, 
    {
        "_id":{"$id":"552384e6e02f4fe237c925d1"},
        "locale":"en_GB"
    }],
    "count":2
}

As you can see, the response will normally have an items section, with the actual result, and a count value, which will always represent the integer number of results.

Show all terms for a given locale

In order to see all the terms (available, translated words) for a given locale (e.g. de_DE), just do:

GET /translation?locale=de_DE

The result will be something like this:

{"items":
    [{
        "Good morning":"Guten Tag"
    },
    {
        "Hello":"Hallo"
    }],
    "total":2
}

At the moment, en_GB is the default locale, in case you don't specify your locale parameter.

Show a single term for a given locale

In order to see only one term (e.g. "Good morning") for a given locale (e.g. it_IT), you can call:

GET /translation/Good+morning?locale=it_IT

The result will be:

{"items":
    [{
        "Good morning":"Buongiorno"
    }],
    "total":1
}

Insert/Update a term for a given locale

To insert a new term, or update an existing one, use the following:

POST /translation/Good+morning?locale=es_ES

with POST parameter translation (e.g. { translation: "Buenas Dias"})

The result will be a true or false value, based on the success of the operation.

Future

As you may have noticed, there is still work necessary in order for MicroTranslator to get where it should. In the future, that's what it will feature:

  • Authentication
  • Docker integration
  • A frontend UI for adding/updating terms (on a separate repository)
  • Some other interesting things!

Questions?

Please send me an email at [email protected] in order to ask your questions about MicroTranslator.

Ideas? Found a bug?

Feel free to open a Github issue or even to fork and create a Pull Request.

microtranslator's People

Contributors

marcotroisi 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.