2017 © Pedro Peláez
 

symfony-bundle remote-translations-bundle

YBRemoteTranslationsBundle - Symfony bundle for using translations stored remotely (API, AWS S3, Google Sheets, PDO).

image

yurijbogdanov/remote-translations-bundle

YBRemoteTranslationsBundle - Symfony bundle for using translations stored remotely (API, AWS S3, Google Sheets, PDO).

  • Thursday, December 14, 2017
  • by yurijbogdanov
  • Repository
  • 1 Watchers
  • 1 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

Symfony bundle for using translations stored remotely (API, AWS S3, Google Sheets, PDO)

Build Status, (*1)

SensioLabsInsight, (*2)

Installation

The YBRemoteTranslationsBundle can be installed:, (*3)

  • via Terminal by executing command:
composer require yurijbogdanov/remote-translations-bundle
  • via Composer by requiring the yurijbogdanov/remote-translations-bundle package in your project's composer.json:
{
    "require": {
        "yurijbogdanov/remote-translations-bundle": "~1.0"
    }
}

and adding an instance of YB\Bundle\RemoteTranslationsBundle\YBRemoteTranslationsBundle to your application's kernel:, (*4)

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        return [
            ...
            new YB\Bundle\RemoteTranslationsBundle\YBRemoteTranslationsBundle(),
        ];
    }
    ...
}

Configuration

Minimum configurations config.yml with only required options:, (*5)

yb_remote_translations:
    api:
        client:
            endpoint: 'http://example.com/no-auth/translations/{domain}/{locale}/'

    awss3:
        client:
            region: 'my-region'
            bucket: 'my-translations-bucket'
            credentials:
                key: 'my-aws-s3-key'
                secret: 'my-aws-s3-secret'

    googlesheets:
        client:
            spreadsheet_id: 'my-google-spreadsheet-id'
            credentials: '%kernel.root_dir%/../var/credentials/google/my-google-project-credentials.json'

    pdo: ~

Full configurations config.yml:, (*6)

yb_remote_translations:
    api:
        loader:
            class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\ApiLoader
        client:
            endpoint: 'http://example.com/basic-auth/translations/{domain}/{locale}/'
            class: GuzzleHttp\Client
            method: 'GET'
            auth: ['my-username', 'my-password']
            headers:
                My-Custom-Header-Key: 'My-Custom-Header-Value'
        logger: logger

    awss3:
        loader:
            class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\AwsS3Loader
        client:
            region: 'my-region'
            bucket: 'my-translations-bucket'
            credentials:
                key: 'my-aws-s3-key'
                secret: 'my-aws-s3-secret'
            class: Aws\S3\S3Client
            version: 'latest'
            file_name_format: '{domain}.{locale}.csv'
        logger: logger

    googlesheets:
        loader:
            class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\GoogleSheetsLoader
        client:
            spreadsheet_id: 'my-google-spreadsheet-id'
            credentials: '%kernel.root_dir%/../var/credentials/google/my-google-project-credentials.json'
            class: Google_Service_Sheets
            sheet_name_format: '{domain}.{locale}'
            sheet_range: 'A1:B'
        logger: logger

    pdo:
        loader:
            class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\PdoLoader
        client:
            dsn: 'mysql:host=%database_host%;port=%database_port%;dbname=%database_name%'
            user: '%database_user%'
            password: '%database_password%'
            class: PDO
            table: 'translations'
            locale_col: 'locale'
            domain_col: 'domain'
            key_col: 'key'
            value_col: 'value'
        logger: logger

Usage

Create empty files in your Resources/translations/ folder using format %domain%.%locale%.%loader%: * for using API create new file with extension .api (e.g. messages.en.api) * for using AWS S3 create new file with extension .awss3 (e.g. messages.en.awss3) * for using Google Sheets create new file with extension .googlesheets (e.g. messages.en.googlesheets) * for using PDO create new file with extension .pdo (e.g. messages.en.pdo), (*7)

ApiLoader

Dependencies: * Guzzle, PHP HTTP client, (*8)

AwsS3Loader

Dependencies: * AWS SDK for PHP, (*9)

GoogleSheetsLoader

Dependencies: * Google APIs Client Library for PHP, (*10)

PdoLoader

Dependencies:, (*11)

MySQL
CREATE TABLE translations (
    id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    locale VARCHAR(128) NOT NULL,
    domain VARCHAR(128) NOT NULL,
    key VARCHAR(128) NOT NULL,
    value TEXT NOT NULL
);
PostgreSQL
CREATE TABLE translations (
  id SERIAL NOT NULL,
  locale VARCHAR(128) NOT NULL,
  domain VARCHAR(128) NOT NULL,
  key VARCHAR(128) NOT NULL,
  value TEXT NOT NULL
);

The Versions

14/12 2017

dev-master

9999999-dev https://github.com/yurijbogdanov/symfony-remote-translations-bundle

YBRemoteTranslationsBundle - Symfony bundle for using translations stored remotely (API, AWS S3, Google Sheets, PDO).

  Sources   Download

MIT

The Requires

 

The Development Requires

by Yurij Bogdanov

php symfony symfony-bundle symfony-translation symfony-translations

14/12 2017

1.0.12

1.0.12.0 https://github.com/yurijbogdanov/symfony-remote-translations-bundle

YBRemoteTranslationsBundle - Symfony bundle for using translations stored remotely (API, AWS S3, Google Sheets, PDO).

  Sources   Download

MIT

The Requires

 

The Development Requires

by Yurij Bogdanov

php symfony symfony-bundle symfony-translation symfony-translations

20/07 2017

1.0.7

1.0.7.0 https://github.com/yurijbogdanov/symfony-remote-translations-bundle

YBRemoteTranslationsBundle - Symfony bundle for using translations stored remotely (API, AWS S3, Google Sheets, PDO).

  Sources   Download

MIT

The Requires

 

The Development Requires

by Yurij Bogdanov

php symfony symfony-bundle symfony-translation symfony-translations

03/06 2017

1.0.0

1.0.0.0 https://github.com/yurijbogdanov/symfony-remote-translations-bundle

Symfony YBRemoteTranslationsBundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Yurij Bogdanov

php symfony symfony-bundle