innova/angular-ui-translation-bundle

Provides a new Angular JS filter which can access to Symfony 2 translations.

5.0.1 2015-10-14 10:04 UTC

README

Provides Symfony 2 translations into your AngularJS application.

Installation

$ composer require "innova/angular-ui-translation-bundle" "~5.0"

Requirements

How To Use ?

As BazingaExposeTranslation, the filter implements the Symfony2 TranslatorInterface and provides the same trans() and transChoice() methods:

{{ 'translation_id' | trans:{}:'DOMAIN_NAME' }}
// the translated message or the translation id

{{ 'translation_id' | transChoice:1:{}:'DOMAIN_NAME' }}
// the translated message or the translation id

If you want to access translations for a specific domain, don't forget to include translation JS file.

Example using assetic :

{% javascripts 'js/translations/DOMAIN_NAME/*.js' %}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}