innova / angular-ui-translation-bundle

提供一个新的Angular JS过滤器,可以访问到Symfony 2的翻译。

5.0.1 2015-10-14 10:04 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:50:30 UTC


README

将Symfony 2翻译集成到您的AngularJS应用程序中。

安装

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

要求

如何使用?

作为BazingaExposeTranslation,过滤器实现了Symfony2的TranslatorInterface接口,并提供相同的trans()transChoice()方法

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

如果您想访问特定域的翻译,请别忘了包含翻译JS文件。

使用assetic的示例

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