2017 © Pedro Peláez
 

symfony-bundle translation-bundle

Doctrine as symfony translation provider + a nice gui for editing translations.

image

ao/translation-bundle

Doctrine as symfony translation provider + a nice gui for editing translations.

  • Thursday, May 14, 2015
  • by adrianolek
  • Repository
  • 3 Watchers
  • 22 Stars
  • 510 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

AOTranslationBundle Overview

This bundle provides doctrine as translations storage and a nice web gui accessible from the profiler for easy translation., (*1)

Build Status, (*2)

Features

  • All translation messages are automatically saved in the database (no extraction necessary)
  • Translation panel available in the Symfony web debug toolbar
  • Only messages used in current action are loaded from the database
  • Translations management backend available via SonataAdminBundle

Installation

Require vendor libraries

Require ao/translation-bundle & stof/doctrine-extensions-bundle in composer.json:, (*3)

"require": {
  "symfony/symfony": "2.1.*",
  "_comment": "other packages",
  "stof/doctrine-extensions-bundle": "1.1.*@dev",
  "ao/translation-bundle": "1.0.*@dev"
}

Then install or update composer bundles with:, (*4)

php composer.phar install

or, (*5)

php composer.phar update

Add bundles to your application kernel

In app/AppKernel.php add:, (*6)

// app/AppKernel.php
public function registerBundles()
{
    return array(
        //...
        new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
        new AO\TranslationBundle\AOTranslationBundle()
        //...
    );
}

Configure translator

# app/config/config.yml
# enable translation component
framework:
    translator: ~

# use AOTranslationBundle as translator
parameters:
    translator.class: AO\TranslationBundle\Translation\Translator

# configure locales avaliable for translation 
ao_translation:
    locales:
        en: ~
        de:
          label: German
        fr: ~

Configure doctrine extensions bundle

Timestampable behavior has to be enabled., (*7)

# app/config/config.yml
stof_doctrine_extensions:
    orm:
        default:
            timestampable: true

Update your db schema

If you use migrations:, (*8)

app/console doctrine:migrations:diff
app/console doctrine:migrations:migrate

Otherwise:, (*9)

app/console doctrine:schema:update

Add routing information

# app/config/routing.yml
ao_translation:
    resource: "@AOTranslationBundle/Controller/"
    type:     annotation
    prefix:   / 

Usage

Use translation methods like described in Symfony Translations documentation., (*10)

Translations panel

You can access translations panel by clicking on Translations in the web debug toolbar., (*11)

Translations web debug toolbar, (*12)

Now you can edit all your translation messages. Message parameters can be inserted directly into translation by clicking on the link in Parameters (2) column. After you are done click the Save Translations button (1)., (*13)

As the translator needs to know which messages are used in each action, it stores this relation in a cache table. Therefore, when a message is not used anymore it will still be visible in the translations panel. To clear the cached messages use the Reset action cache (3) button, which will clear the cache for current action. Alternatively use the Reset cache (4) button, which will clear cache for all actions. The cache will be rebuilt with the next execution of an action., (*14)

Translations panel, (*15)

Translations backend

In order to use translations backend you need to install SonataAdminBundle and SonataDoctrineORMAdminBundle. Please refer to their installation guide. After installation and configuration the backend will be available under /admin/ao/translation/message/list., (*16)

Additional features

Using separate database connection for storing translations

In case you need to share the translations database (eg. when multiple developers collaborate) you can configure separate entity manager for the bundle., (*17)

# app/config/config.yml
doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                ...
            # configure translations database connection
            translations:
                ...

orm:
    ...
    default_entity_manager: default
    entity_managers:
        default:
            connection: default
            mappings:
                ...
        translations:
            connection: translations
            mappings:
                AOTranslationBundle: ~

ao_translation:
    entity_manager: translations

stof_doctrine_extensions:
    orm:
        ...
        # enable timestampable behavior for translations entity manager
        translations:
            timestampable: true

To create translations schema add use --em parameter like:, (*18)

app/console doctrine:schema:create --em=translations

The Versions

14/05 2015

dev-master

9999999-dev https://github.com/adrianolek/AOTranslationBundle

Doctrine as symfony translation provider + a nice gui for editing translations.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Olek

ui doctrine symfony translation i18n multilanguage gui interface webinterface wordings

12/05 2015

1.0.4

1.0.4.0 https://github.com/adrianolek/AOTranslationBundle

Doctrine as symfony translation provider + a nice gui for editing translations.

  Sources   Download

MIT

The Requires

 

by Adrian Olek

ui doctrine symfony translation i18n multilanguage gui interface webinterface wordings

06/05 2015

1.0.3

1.0.3.0 https://github.com/adrianolek/AOTranslationBundle

Doctrine as symfony translation provider + a nice gui for editing translations.

  Sources   Download

MIT

The Requires

 

by Adrian Olek

ui doctrine symfony translation i18n multilanguage gui interface webinterface wordings

01/10 2014

1.0.2

1.0.2.0 https://github.com/adrianolek/AOTranslationBundle

Doctrine as symfony translation provider + a nice gui for editing translations.

  Sources   Download

MIT

The Requires

 

by Adrian Olek

ui doctrine symfony translation i18n multilanguage gui interface webinterface wordings

22/09 2014

1.0.1

1.0.1.0 https://github.com/adrianolek/AOTranslationBundle

Doctrine as symfony translation provider + a nice gui for editing translations.

  Sources   Download

MIT

The Requires

 

by Adrian Olek

ui doctrine symfony translation i18n multilanguage gui interface webinterface wordings

07/03 2013

1.0.0

1.0.0.0 https://github.com/adrianolek/AOTranslationBundle

Doctrine as symfony translation provider + a nice gui for editing translations.

  Sources   Download

MIT

The Requires

 

by Adrian Olek

ui doctrine symfony translation i18n multilanguage gui interface webinterface wordings