Coder Social home page Coder Social logo

chandon / translatorbundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from domis86/translatorbundle

0.0 1.0 0.0 337 KB

Easily edit Symfony2 translations while browsing your site

License: Do What The F*ck You Want To Public License

PHP 75.80% JavaScript 15.25% HTML 8.95%

translatorbundle's Introduction

domis86/TranslatorBundle

SensioLabsInsight

What is it ?

Symfony2 bundle which helps in translation.

A Symfony2 bundle which helps in editing of translations without need for editing the translations files. Edit can be performed via symfony WebDebugToolbar (translations from current request) or backend admin interface (all translations). Translations are stored in db and retrieved in a efficient way (+cached).

The Symfony2 WebDebugToolbar shows number of translations used in current request: Domis86Translator in WebDebugToolbar

If you click on it a Edit Dialog will appear where you can edit translations used in current request: Domis86Translator Edit Dialog

Tranlation missing - indicates that translation for this language is missing - click and add it!

Tranlation missing - Black text is current translation stored in db. Blue text means that it is translation loaded from file - via default Symfony2 Translator service (messages.en.yml etc). It will be used if there is no translation in DB.

In this example hello is translated to Hallo when language is germangerman, but when language is frenchfrench then it is translated to Bonjour (which resides somewhere in messages.fr.yml). Hit ( Click to edit ) above Bonjour to change it.

You can also browse [your_domain.com]/app_dev.php/domis86translator/backend to edit all translations used in your application.

Features

  • edit/add translations without need of messing with translations files
  • integration with Symfony2 WebDebugToolbar (dev env)
    • info how many translated/used messages was in request
  • robust Edit Dialog (js) activated by clicking on WebDebugToolbar
    • search/sort your translations by name, domain name, content
    • just click on translation, edit it in place and save
    • click on Help button in Dialog for more info
  • manage all translations from you application in Backend (same features as Edit Dialog)
  • translations are stored in DB, and cached per Action

Installation

Add the domis86/translator-bundle package to your require section in the composer.json file:

    ...
    "require": {
        ...
        "domis86/translator-bundle": "dev-master"
    },
    ...

Add the Domis86TranslatorBundle to your AppKernel:

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Domis86\TranslatorBundle\Domis86TranslatorBundle(),
        // ...
    );
    ...
}

Enable this bundle and configure managed_locales in your config.yml:

# config.yml
domis86_translator:
    is_enabled: true
    managed_locales: [en, fr, de]

Enable Dialog for dev environment in your config_dev.yml:

# config_dev.yml
domis86_translator:
    is_web_debug_dialog_enabled: true

Add routes in your routing_dev.yml:

# routing_dev.yml
domis86_translator_routing:
    resource: "@Domis86TranslatorBundle/Resources/config/routing.yml"
    prefix:   /domis86translator

Update your database:

php app/console doctrine:schema:update --force

Install assets

php app/console assets:install

Optional config:

If your web server's DocumentRoot points to some other dir than symfony's /web dir then you can change domis86_translator.assets_base_path accordingly (default is /bundles/domis86translator/). Assuming your app.php url is http://localhost/uglydirectory/web/app.php then you should do:

domis86_translator:
    managed_locales: [en, fr, de]
    assets_base_path: /uglydirectory/web/bundles/domis86translator/

Used libraries:

Latest Stable Version Total Downloads Latest Unstable Version License

translatorbundle's People

Contributors

domis86 avatar chandon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.