{"id":14984007,"url":"https://github.com/boxuk/angular-symfony-translation","last_synced_at":"2025-04-10T19:43:20.591Z","repository":{"id":21113424,"uuid":"24414013","full_name":"boxuk/angular-symfony-translation","owner":"boxuk","description":"Integrates BazingaJS Translation bundle with AngularJS.","archived":false,"fork":false,"pushed_at":"2016-06-15T12:15:13.000Z","size":88,"stargazers_count":13,"open_issues_count":5,"forks_count":5,"subscribers_count":45,"default_branch":"master","last_synced_at":"2024-04-15T07:38:58.283Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boxuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-24T12:27:43.000Z","updated_at":"2016-05-27T13:40:41.000Z","dependencies_parsed_at":"2022-08-25T14:41:19.498Z","dependency_job_id":null,"html_url":"https://github.com/boxuk/angular-symfony-translation","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fangular-symfony-translation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fangular-symfony-translation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fangular-symfony-translation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxuk%2Fangular-symfony-translation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxuk","download_url":"https://codeload.github.com/boxuk/angular-symfony-translation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281424,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:08:18.672Z","updated_at":"2025-04-10T19:43:20.568Z","avatar_url":"https://github.com/boxuk.png","language":"JavaScript","readme":"AngularJS Translations, powered by Symfony2\n===========================================\n[![NPM version](https://badge.fury.io/js/angular-symfony-translation.png)](https://www.npmjs.org/package/angular-symfony-translation) [![Build Status](https://travis-ci.org/boxuk/angular-symfony-translation.svg)](https://travis-ci.org/boxuk/angular-symfony-translation) [![Code Climate](https://codeclimate.com/github/boxuk/angular-symfony-translation/badges/gpa.svg)](https://codeclimate.com/github/boxuk/angular-symfony-translation) [![Coverage Status](https://img.shields.io/coveralls/boxuk/angular-symfony-translation.svg)](https://coveralls.io/r/boxuk/angular-symfony-translation)\n\n\u003e Integrates BazingaJS Translation bundle with AngularJS.\n\nWhen integrating an Angular application with Symfony2, you can quickly find\nyourself in an awkward situation when it comes to dealing with translations.\n\nYou have all of your translations server-side and exposed to your JS using\nthe excellent [Bazinga JS Translations Bundle](https://github.com/willdurand/BazingaJsTranslationBundle),\nbut how do you access those translations from your Angular app (including your view\npartials)?\n\nThis Angular module provides functionality to access translations exposed\nby the above mentioned Symfony2 bundle from within your Angular app.\n\n## Key points:\n\n* Works with both `1.x` and `2.x` versions of the Bazinga JS Translation bundle.\n* Provides `trans` and `transChoice` filters with the same method signatures as\n  the methods provided by the BazingaJS bundle.\n* Uses an adapter so you can use `2.x` syntax regardless of whether you're using\n  `1.x` or `2.x`.\n\n## Installation\n\n* `bower install --save angular-symfony-translation`\nor\n* `npm install --save angular-symfony-translation`\n\nInclude `dist/angular-symfony-translation.js` before your Angular app\n(either as a `\u003cscript\u003e` tag or as part of your build script).\n\nList the module as a dependency of your app:\n\n```javascript\nangular.module('myApplication', ['boxuk.translation']);\n```\n\n## Usage\n\nThe following assumes you already have [Bazinga JS Translations Bundle](https://github.com/willdurand/BazingaJsTranslationBundle)\nsetup and working.\n\nThis module exposes an API that matches what is provided by version\n**2.x** of the BazingaJS bundle. If you're using a **1.x** release, you can\nstill use this module with no further modifications as the module will handle\ntransforming method calls for the older API.\n\n### General documentation:\n\nThe filters provided by this module match the BazingaJS bundle as closely as\npossible. As such, the documentation provided by that bundle should be consulted\nfor more detail on usage, e.g. parameters, pluralization, etc.\n\nThis documentation will cover the **differences in usage** and nothing else.\n\n### In a view partial:\n\n#### `trans` filter:\n\n```html\n\u003c!-- Basic usage --\u003e\n\u003cp\u003e{{ 'key' | trans }}\u003c/p\u003e\n\n\u003c!-- With custom params and domain --\u003e\n\u003cp\u003e{{ 'key' | trans: { 'foo': 'bar' }: 'my_domain' }}\u003c/p\u003e\n```\n\n\n#### `transChoice` filter:\n\n```yaml\n# app/Resources/messages.en.yml\nsalmon: \"{0} No salmon today, sorry.|{1} We have a single salmon!|[1,Inf] Woah, there's %count% salmon. That's a lot of salmon.\"\n```\n\n```html\n\u003c!-- Basic usage --\u003e\n\u003cp\u003e{{ 'salmon' | transChoice: 5: {'count': 5} }}\u003c/p\u003e\n\n\u003c!-- With custom domain --\u003e\n\u003cp\u003e{{ 'salmon' | transChoice: 5: {'count': 5}: 'my_domain' }}\u003c/p\u003e\n```\n\n#### `TranslationService`:\n\nBoth of the above filters make use of the translation service, which either directly exposes the `Translator`\nobject from the *BazingaJS Translation bundle* (for version 2.x of the bundle) or exposes a 2.x to 1.x adapter.\n\nExposes the same interface as the 2.x version of the bundle: [see the bundle documentation for more details](https://github.com/willdurand/BazingaJsTranslationBundle/blob/v2.2.0/Resources/doc/index.md#the-js-translator).\n\n##### `trans`\n\n###### Parameters\n\n| Name   | Type    | Description                             |\n|--------|---------|-----------------------------------------|\n| key    | String  | The translation key to lookup           |\n| params | Object= | Translation parameters                  |\n| domain | String= | The domain to use (default: `messages`) |\n\n##### `transChoice`\n\n###### Parameters\n\n| Name   | Type    | Description                             |\n|--------|---------|-----------------------------------------|\n| key    | String  | The translation key to lookup           |\n| count  | Number  | The number to use for pluralization     |\n| params | Object= | Translation parameters                  |\n| domain | String= | The domain to use (default: `messages`) |\n\n##### Service usage\n\n```javascript\nfunction DogsController(TranslationService, DogsService) {\n  /**\n   * @type {Array.\u003cDog\u003e}\n   */\n  var dogs = DogsService.getDogs();\n  \n  /**\n   * Getting a simple translation\n   *\n   * @type {String}\n   */\n  var title = TranslationService.trans('some_title');\n  \n  /**\n   * Using pluralization\n   *\n   * @type {String}\n   */\n  var message = TranslationService.transChoice('number_of_dogs', dogs.length);\n}\n```\n\n## System overview\n\nProbably only relevant if you're planning on developing this further:\n\n![System diagram](/docs/system-overview.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxuk%2Fangular-symfony-translation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxuk%2Fangular-symfony-translation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxuk%2Fangular-symfony-translation/lists"}