Coder Social home page Coder Social logo

nelson's Introduction

Collection of commands to synchronize Github repositories with Crowdin translations

Build Status

How does it work?

Synchronizing a Github repository with Crowdin translations can be performed in a few steps.

First, you must tell Crowdin which keys to translate. In order to do that, you have to select the "source" locale from which your contributors will make their translations. All translation keys are located in different files that you can configure using a Symfony Finder. Nelson provides a command (push-translation-keys) to send new translations to Crowdin from the source locale.

Once the keys have been sent, your contributors will have the ability to edit, add and delete new translations in their language.

Next, When the keys have been translated, you must pull them back in your Github repository. This command (pull-translations) tells Crowdin to create a package for each language, downloads the packages and checks the differences with your up-to-date repository. You can set an option in this tool to only pull languages that are translated to at least a given percentage (e.g. 90%). If it detects differences (new translations, deleted translations or modified translations), it automatically creates a new Pull Request on your repository. Finally, you have the option to manually accept or refuse the Pull Request, depending on its content. This last command can be automated via a Cron.

And voilà! Your GitHub repository will always be up-to-date and users will have the latest translations.

Installation

Warning You must create your own fork in a dedicated git repository that will only be used for this purpose. This will allow you to pull translations and create pull requests. You must never run the following commands using your main repository, because Nestor merges the latest commits automatically.

  $ git clone [email protected]:akeneo/nelson.git
  $ cd nelson
  $ composer update

Create your own configuration

This package includes an example of configuration located in app/config.example.yml that you should adapt according to your settings and save it as app/config.yml.

If you want to manage several configurations for multiple projects, you can use --config_file=yourconfig.yml.

How to use it?

  • To display languages that are going to be synchronized

    $ php app/console nelson:info-translated-progress

  • To Create language packages in Crowdin

    $ php app/console nelson:refresh-packages

  • To push the new translation keys to Crowdin

    $ php app/console nelson:push-translation-keys

  • To pull translations (creates PR to your main repository)

    $ php app/console nelson:pull-translations

Update the crontab

You can set up a crontab to run Nelson commands on a regular basis. The first step is always to refresh the Crowdin package to get the latest updates. To update crontab, use crontab -e.

An example of crontab to push new keys every friday and create pull requests every saturday:

30 * * * * cd /path/to/nelson/ && app/console nelson:refresh-packages > /tmp/nelson_refresh.log 2>&1
0 4 * * 1 cd /path/to/nelson/ && app/console nelson:pull-translations > /tmp/nelson_pull.log 2>&1
0 5 * * 1 cd /path/to/nelson/ && app/console nelson:push-translation-keys > /tmp/nelson_push.log 2>&1

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.