liip/LiipTranslationBundle

Name: LiipTranslationBundle

Owner: Liip

Description: Tools for translation management

Created: 2013-09-09 08:05:26.0

Updated: 2018-02-03 16:34:09.0

Pushed: 2017-12-05 09:48:18.0

Homepage: null

Size: 520

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

UNMAINTAINED

This bundle is no longer maintained. Feel free to fork it if needed.

LiipTranslationBundle

Build Status

This Bundle provides various tools to ease translations management of a Sf2 app. Here is a small presentation of the bundle.

Introduction

This bundle adds a new layer on top of existing translation mechanisms. This allows your customers to edit and override any translations directly from the website.

Separation of concern

Using such a tool allows a clear separation between “key” and “value”. Developers are responsible for defining new keys and removing old keys, while client/customer are responsible for translating the website.

Key values on steroid

The current basic key-value system could be better. We extend it and allow developers to complete keys with metadata (like it's possible with XLiFF).

Extend your keys with information like maxbytes, comment, description, urls, screenshot, etc… Anything that could help translators.

A “value” is the translation for a “key” in a given locale, it's also possible to complete it with metadata (comments, update date, validity, etc…)

Storage layer

The intermediate storage is currently available for:

but adding a new persistence implementation is very easy (you just have to implement a small interface)

Symfony compatibility

This bundle works on any Symfony versions 2.3+. Unit and functional tests have been written to ensure this compatibility.

Features
Translation interface in the backend
Import/Export

Useful to provide files to an external agency, or to transfer translations from a staging environment to production

New translation keys insertion
Security
Installation
  1. Via composer

      composer require liip/translation-bundle master-dev
    
Configuration

Include the bundle in your AppKernel.php:

public function registerBundles()
{
    $bundles = array(
        // ...
        new Liip\TranslationBundle\LiipTranslationBundle(),
        // ...
    );
    // ...
}

In your config.yml add the given Bundle specific configuration, for example:

liip_translation:
    locale_list: [en_JP, en_US, en, fr_CH, fr]
    security:
        by_domain: false
        by_locale: true
    persistence:
        class: Liip\TranslationBundle\Persistence\YamlFilePersistence
        options:
            folder: "%kernel.root_dir%/data/translations"
    interface:
        default_filters:
          domain: ['messages']
          languages: ['en', 'fr']

Also load the routes:

_liip_translation:
    resource: "@LiipTranslationBundle/Resources/config/routing.yml"
    prefix: /translation

Alternatively you can load the translation and import interface routes separately:

_liip_translation_interface:
    resource: "@LiipTranslationBundle/Resources/config/routing_translation_interface.yml"

_liip_translation_import_interface:
    resource: "@LiipTranslationBundle/Resources/config/routing_import_interface.yml"
Security

Access to translation management can be restricted by domains or by locales. By default, those restrictions are disabled, you can turn them on in the config, with:

liip_translation:
    ...
    security:
        by_domain: false
        by_locale: true

You can activate one or both restrictions together. Once this have been activated, you have to attribute associated roles to your users. The existing roles are:

ROLE_TRANSLATOR_ADMIN
    ROLE_TRANSLATOR_ALL_DOMAINS
        ROLE_TRANSLATOR_DOMAIN_XXX
    ROLE_TRANSLATOR_ALL_LOCALES
        ROLE_TRANSLATOR_LOCALE_XXX

!! Warning, if you use security by domain, you have to explicitly list the domains. Example:

    security:
        by_domain: true
        domain_list: [messages, validators, forms]
Contributing

Pull requests are welcome. Please see our CONTRIBUTING guide.

This bundle is fully tested with PHPUnit, the tests suite can be run using the following commands :

      git clone git@github.com:liip/LiipTranslationBundle.git && cd LiipTranslationBundle
      composer install --dev
      phpunit

Thanks to everyone who has contributed already.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.