{"id":18773102,"url":"https://github.com/webfactory/webfactoryicutranslationbundle","last_synced_at":"2025-02-27T02:16:08.062Z","repository":{"id":14532654,"uuid":"17247282","full_name":"webfactory/WebfactoryIcuTranslationBundle","owner":"webfactory","description":"Enables ICU message formatting for translations in Symfony applications.","archived":false,"fork":false,"pushed_at":"2024-08-27T11:33:35.000Z","size":248,"stargazers_count":27,"open_issues_count":0,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-20T01:12:13.094Z","etag":null,"topics":["bundle","i18n","icu","l10n","php","symfony","symfony-bundle","translation"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/webfactory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-27T11:57:50.000Z","updated_at":"2024-08-27T11:33:38.000Z","dependencies_parsed_at":"2024-11-07T19:36:20.343Z","dependency_job_id":"18b99053-49e3-4ae7-a037-fce6c5df8bac","html_url":"https://github.com/webfactory/WebfactoryIcuTranslationBundle","commit_stats":{"total_commits":221,"total_committers":8,"mean_commits":27.625,"dds":0.2850678733031674,"last_synced_commit":"9cd1094b65061933cce159aa0f1768f687927769"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2FWebfactoryIcuTranslationBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2FWebfactoryIcuTranslationBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2FWebfactoryIcuTranslationBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2FWebfactoryIcuTranslationBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webfactory","download_url":"https://codeload.github.com/webfactory/WebfactoryIcuTranslationBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240964336,"owners_count":19885730,"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":["bundle","i18n","icu","l10n","php","symfony","symfony-bundle","translation"],"created_at":"2024-11-07T19:32:46.810Z","updated_at":"2025-02-27T02:16:08.035Z","avatar_url":"https://github.com/webfactory.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ICU Translation Bundle #\n\n[![Build Status](https://travis-ci.org/webfactory/WebfactoryIcuTranslationBundle.svg?branch=master)](https://travis-ci.org/webfactory/WebfactoryIcuTranslationBundle)\n[![Coverage Status](https://coveralls.io/repos/webfactory/icu-translation-bundle/badge.png?branch=master)](https://coveralls.io/r/webfactory/icu-translation-bundle?branch=master)\n\nWhile the [Symfony translation component](http://symfony.com/doc/current/components/translation/index.html) does a\ngreat job in most cases, it can become difficult to use if you need conditions other than numbers (e.g. gender) or\nnested conditions. This is where the ICU Translation Bundle steps in. Using the [International Components for Unicode\nproject](http://site.icu-project.org/)'s standard message format, it enhances the Symfony component with arbitrary and\nnested conditions, as well as easy-to-use localized number and date formatting. The enhancement is non-invasive, i.e.\nyou don't have to touch your former messages, they'll still work as usual.\n\n## Installation ##\n\nAssuming you've already [enabled and configured the Symfony translation component](http://symfony.com/doc/current/book/translation.html#book-translation-configuration),\nall you have to do is to install the bundle via [composer](https://getcomposer.org) with something like this:\n\n    php composer.phar require webfactory/icu-translation-bundle\n\n(We use [Semantic Versioning](http://semver.org/), so as soon as a version tagged 1.0.0 is available, you'll probably\nwant to use something like ~1.0 as the version string.)\n\nAs usual, enable the bundle in your kernel:\n\n    \u003c?php\n    // app/AppKernel.php\n\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new \\Webfactory\\IcuTranslationBundle\\WebfactoryIcuTranslationBundle()\n        );\n        // ...\n    }\n\n## Usage ##\n\nTo use the bundle's enhancements, you need to use a special syntax with curly braces in your translation messages. The\nfollowing examples show this syntax for common use cases. For a comprehensive list, please refer to [bundle\ndocumentation](Resources/doc/index.rst).\n\n### Number formatting with a parameter type ###\n\nIn your messages, you can specify \"number\" as a parameter type after a variable. If so, the output is localized with the\ncorrect thousands separator and decimal mark. See this example message stored under the key \"message-number\":\n\n    1 mile = {mile_to_metres, number} metres\n\nIn a controller, the example could look like this:\n\n    $translator = $this-\u003eget('translator');\n    $output = $translator-\u003etrans(\n        'message-number',\n        array('%mile_to_metres%' =\u003e 1609.34)\n    );\n\nE.g. for the locale \"en\", the output will be \"1 mile = 1,609.34 metres\", while for the locale \"de\" it will be \"1 mile =\n1.609,34 metres\" (or \"1 Meile = 1.609,34 Meter\" with a proper translation).\n\nFor other parameter types such as date, see the bundle documentation.\n\n### Gender Specific Translations ###\n\nGender specific translations are a special case of arbitrary conditions. Conditions are denoted by the key word \"select\"\nafter the variable, followed by possible variable values and their respective messages. See the following example\nmessage stored for the locale \"en\" under the key \"message-gender\":\n\n    {gender, select,\n        female {She spent all her money on horses}\n        other {He spent all his money on horses}\n    }\n\nIf your controller looks something like this:\n\n    $output = $translator-\u003etrans(\n        'message-gender',\n        array('%gender%' =\u003e 'male')\n    );\n\nthe output will be \"He spent all his money on horses\" for the locale \"en\".\n\nWhy didn't we list \"female\" and \"male\" as possible variable values in the message, but \"female\" and \"other\" instead?\nFind out in the bundle documentation.\n\n### More Readable Pluralization ###\n\nWhile [Symfony's translation component already supports pluralization](http://symfony.com/doc/current/components/translation/usage.html#component-translation-pluralization),\nwe think the ICU Translation Bundle provides it in a more readable way. Analogously to conditions, pluralizations are\ndenoted by the key word \"plural\" after the variable, followed by possible variable values and their respective messages.\nSee the following example message stored for the locale \"en\" under the key \"message-pluralization\":\n\n    {number_of_participants, plural,\n        =0 {Nobody is participating}\n        =1 {One person participates}\n        other {# persons are participating}\n    }\n\nIf your controller looks something like this:\n\n    $output = $translator-\u003etrans(\n        'message-pluralization',\n        array('%number_of_participants%' =\u003e 2)\n    );\n\nThe output for the locale \"en\" will be: \"2 persons are participating\".\n\nNote that you can distinguish both between exact numbers like with \"=0\" and [Unicode Common Locale Data Repository\nnumber categories](http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html) like \"other\". Also\nnote that the number sign \"#\" becomes substituted with the value of the variable, 2 in this example.\n\nNow that you've got an idea of the ICU translation bundle's features, we once more invite you to read the [bundle\ndocumentation](Resources/doc/index.rst).\n\n## Changelog ##\n\n### 0.5.0 -\u003e 0.6.0 ###\n\nIntroduced logging of missing parameters.\n\n### 0.4.0 -\u003e 0.5.0 ###\n\nImproved performance by removing lexer/parser classes and message rewriting that was necessary to support named\nparameters in PHP versions \u003c 5.5.\n\n### 0.3.0 -\u003e 0.4.0 ###\n\nSymfony 3 is now supported.\n\n### 0.2.3 -\u003e 0.3.0 ###\n\nDropped support for PHP 5.3 and 5.4, added support for PHP 7.\n\n### 0.2.2 -\u003e 0.2.3 ###\n\nThe ``GracefulExceptionsDecorator`` logs all types of exception now, not just instances of ``FormattingException``.\n\nCredits, Copyright and License\n------------------------------\nCopyright 2012-2019 webfactory GmbH, Bonn. Code released under [the MIT license](LICENSE).\n\n- \u003chttps://www.webfactory.de\u003e\n- \u003chttps://twitter.com/webfactory\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfactory%2Fwebfactoryicutranslationbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebfactory%2Fwebfactoryicutranslationbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfactory%2Fwebfactoryicutranslationbundle/lists"}