skolodyazhnyy/onesky-bundle

Onesky Translations Downloader

Installs: 442

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 2

Open Issues: 1

Type:symfony-bundle

1.0.0 2015-03-17 00:28 UTC

This package is auto-updated.

Last update: 2024-10-30 01:42:36 UTC


README

Installation

Add bundle to your composer requirements

php composer.phar require skolodyazhnyy/onesky-bundle

Add bundle to your application kernel (app/AppKernel.php)

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            ...
            new Seven\Bundle\OneskyBundle\SevenOneskyBundle(),
        );

Create a configuration for the bundle. Add following configuration to your app/config/config.yml

seven_onesky:
    api_key: %onesky_api_key%
    secret:  %onesky_secret%
    project: %onesky_project%
    # Configure mappings to match your needs, every mapping includes,
    #    sources - list of files to export, all by default
    #    locales - list of locales to export, all by default
    #    output - output filename pattern, you can use [filename], [locale], [extension] and [dirname] as parameters
    mappings:
        - { sources: ["messages.xliff"], locales: ["en", "es"], output: "%kernel.root_dir%/Resources/translations/messages.[locale].xliff" }

Setup OpenSky API parameters in app/config/parameters.yml

parameters:
    onesky_api_key: <replace with your OneSky API key>
    onesky_secret: <replace with your OneSky secret>
    onesky_project: <replace with your OneSky project ID>

Usage

Simply run onesky:dump command to dump all your location files to desired destination,

app/console onesky:dump

You are free to keep your translations under version control system or outside.

Usage with capifony

If you are using capifony you can setup a task to update translations on remote server, simply add this task to your app/deploy.rb:

namespace :onesky do
  desc "Dumps all translations from OneSky"
  task :dump, :roles => :app, :except => { :no_release => true } do
    capifony_pretty_print "--> Dumping all translations"

    run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} onesky:dump #{console_options}'"
    capifony_puts_ok
  end
end

And then run it, using

cap onesky:dump

Also you can add it to the deployment process

after "symfony:assetic:dump", "onesky:dump"