2017 © Pedro Peláez
 

symfony-bundle translator-bundle

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages.

image

docteurklein/translator-bundle

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages.

  • Wednesday, July 20, 2016
  • by florian.klein@free.fr
  • Repository
  • 3 Watchers
  • 50 Stars
  • 2,639 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 14 Forks
  • 7 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

TranslatorBundle

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages., (*1)

Currently supported formats:, (*2)

  • YAML
  • XLIFF
  • CSV

Install & setup the bundle

  1. Install via composer
    composer require docteurklein/translator-bundle=~3.0
  1. Add the bundle to your AppKernel class

``` php // app/AppKernerl.php public function registerBundles() { $bundles = array( // ... new Knp\Bundle\TranslatorBundle\KnpTranslatorBundle, // ... ); // ... }, (*3)



3. Add routing ``` yaml // app/config/routing.yml knplabs_translator_admin: resource: @KnpTranslatorBundle/Resources/config/routing/edition.yml prefix: /trans/admin knplabs_translator: resource: @KnpTranslatorBundle/Resources/config/routing/routing.yml prefix: /trans

These route files provide the following routes:, (*4)

[router] Current routes
Name                     Method  Pattern
knplabs_translator_list  GET    /trans/admin/list
knplabs_translator_get   GET    /trans/{id}/{domain}/{locale}
knplabs_translator_put   PUT    /trans/

Minimal configuration

This bundle requires the activation of the core translator:, (*5)

``` yaml // app/config/config.yml framework: # ... translator: { fallback: en } # ..., (*6)


Additional configuration ------------------------ This bundle relies on the Ext Core library. You can decide wheter or not it will be included automatically. ``` yaml knplabs_translator: include_vendor_assets: false # defaults to true

Services

This bundle introduces those services:, (*7)

knp_translator.dumper.csv                    container Knp\Bundle\TranslatorBundle\Dumper\CsvDumper
knp_translator.dumper.xliff                  container Knp\Bundle\TranslatorBundle\Dumper\XliffDumper
knp_translator.dumper.yaml                   container Knp\Bundle\TranslatorBundle\Dumper\YamlDumper
knp_translator.writer                        container Knp\Bundle\TranslatorBundle\Translation\Writer

controllers are services too:

knp_translator.controller.edition    request   Knp\Bundle\TranslatorBundle\Controller\EditionController
knp_translator.controller.translator request   Knp\Bundle\TranslatorBundle\Controller\TranslatorController

API

Updating a given translation key is really simple:, (*8)

``` php $this->get('translator.writer')->write('the key to translate', 'the translated string', 'messages', 'en');, (*9)



Rest API -------- * Update `english` translations files for domain `tests` with `translated value` for key `foo.bar.baz` ``` bash curl -X PUT http://project-url/trans/ \ -F 'id=foo.bar.baz' \ -F 'domain=messages' \ -F 'locale=en' \ -F 'value=translate value'
  • Get the translated value of key foo.bar.baz for english locale for tests domain

bash curl http://project-url/trans/foo.bar.baz/tests/en, (*10)

The Versions

20/07 2016

dev-master

9999999-dev

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages.

  Sources   Download

MIT

The Requires

 

translator

05/10 2015

3.0.1

3.0.1.0

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages.

  Sources   Download

MIT

The Requires

 

translator

18/09 2015

dev-3.0-dev

dev-3.0-dev

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages.

  Sources   Download

MIT

The Requires

 

translator

18/09 2015

3.0.0

3.0.0.0

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages.

  Sources   Download

MIT

The Requires

 

translator

23/07 2013

2.1.0

2.1.0.0

This bundle's purpose is to provide an interface for edition, addition and deletion of translations messages.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

translator