Developed with love by KnpLabs Hire us for your project!
32

LiipTranslationBundle

by liip

Tools for translation management

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 add a new layer in top of the translation mechanisms. This allows your customer 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 informations 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:

  • Propel (database)
  • YAML (file or in Git)

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

Symfony compatibility

This bundle work on any symfony 2.0+ version. Unit and functional tests have been written to ensure this compatibilty.

Features

Translation interface in the backend

  • Edit through a contextual popin
  • Fast inline editing
  • Possibility to view various translated column at the same time (en, fr, pt, etc...)
  • Filter by locale, domain, date
  • Filter for untranslated key
  • Search by key name or translation value
  • Display help messages from the developpers

Import/Export

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

  • Export translation to a YAML file
  • Export based on the current list filter
  • Export/import multi domain/language with a zip file
  • Review change interface to handle collision at import time

New translation keys insertion

  • Developers can provide context information to a translation keys (maxsize, description, comment, url, etc..)
  • Symfony command for developers to insert new complex keys into Xliff

Security

  • Rights management (restricted to given locale or given domain)

Installation

  1. Via composer

      composer require liip/translation-bundle master-dev
    

Configuration

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']

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.

The MIT License (MIT)

Copyright (c) 2013 Liip AG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
liip_translation:
locale_list:

# Defaults:
- en
- en_US
persistence:
class: Liip\TranslationBundle\Persistence\YamlFilePersistence # Required
options:
folder: %kernel.root_dir%/data/translations
security:
by_domain: false
by_locale: false
domain_list:

# Defaults:
- en
- en_US
interface:
default_filters: Array
  • Release of new version 0.0.10
    By krtek4, 3 years ago
  • Merge pull request #30 from thormeier/git-storage
    By lsmith77, 3 years ago
  • Add output for cancelling
    By thormeier, 3 years ago
  • Tweaking in several places
    By thormeier, 3 years ago
  • Shorten auto-commit messages
    By thormeier, 3 years ago
  • Only consider error when output is given
    By thormeier, 3 years ago
  • Fix git commands
    By thormeier, 3 years ago
  • more minor tweak
    By lsmith77, 3 years ago
  • minor tweaks
    By lsmith77, 3 years ago
  • Merge pull request #27 from liip/various_fixes
    By krtek4, 3 years ago
  • Merge pull request #23 from thormeier/git-storage
    By krtek4, 3 years ago
  • fix travis setup
    By lsmith77, 3 years ago
  • Move cloning to persistence
    By thormeier, 3 years ago
  • fix overwriting the default translator service
    By lsmith77, 3 years ago
  • ensure proper namespacing of services
    By lsmith77, 3 years ago
  • prevent notices
    By lsmith77, 3 years ago
  • use stable dependencies
    By lsmith77, 3 years ago
  • I changed name last year :)
    By krtek4, 3 years ago
  • Replace author annotations
    By thormeier, 3 years ago
  • More cleanups
    By thormeier, 3 years ago
  • Cleanups
    By thormeier, 3 years ago
  • Fix class names
    By thormeier, 3 years ago
  • Add new command to update translations in git
    By thormeier, 3 years ago
  • Add command to init git repo
    By thormeier, 3 years ago
  • Add Git persistence
    By thormeier, 3 years ago
  • Merge pull request #28 from liip/phpcs-fixes
    By dbu, 3 years ago
  • applying the automatic php-cs-fixer
    By dbu, 3 years ago
  • phpcs fixes
    By dbu, 3 years ago
  • Merge pull request #26 from liip/test-cleanup
    By dbu, 3 years ago
  • testing symfony 2.7 and adjust notification
    By dbu, 3 years ago