innova / angular-ui-translation-bundle
Provides a new Angular JS filter which can access to Symfony 2 translations.
Installs: 1 685
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 11
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
- innova/angular-js-bundle: ~5.0
- symfony/symfony: 2.*
- willdurand/js-translation-bundle: ~2.1
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 %}