{"id":18600624,"url":"https://github.com/rostenkowski/translate","last_synced_at":"2025-04-10T18:31:28.951Z","repository":{"id":62537420,"uuid":"104400821","full_name":"rostenkowski/translate","owner":"rostenkowski","description":"High Performance Localization Component for PHP 7","archived":false,"fork":false,"pushed_at":"2019-04-10T07:55:17.000Z","size":53,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T02:51:34.775Z","etag":null,"topics":["component","high-performance","localization","nette","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rostenkowski.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}},"created_at":"2017-09-21T21:29:26.000Z","updated_at":"2019-06-04T18:39:18.000Z","dependencies_parsed_at":"2022-11-02T16:01:17.912Z","dependency_job_id":null,"html_url":"https://github.com/rostenkowski/translate","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rostenkowski%2Ftranslate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rostenkowski%2Ftranslate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rostenkowski%2Ftranslate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rostenkowski%2Ftranslate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rostenkowski","download_url":"https://codeload.github.com/rostenkowski/translate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248271750,"owners_count":21075800,"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":["component","high-performance","localization","nette","php"],"created_at":"2024-11-07T02:04:45.605Z","updated_at":"2025-04-10T18:31:28.324Z","avatar_url":"https://github.com/rostenkowski.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Translate [![Build Status](https://travis-ci.org/rostenkowski/translate.svg?branch=master)](https://travis-ci.org/rostenkowski/translate) [![Coverage Status](https://coveralls.io/repos/github/rostenkowski/translate/badge.svg)](https://coveralls.io/github/rostenkowski/translate)\n\nMinimalistic yet powerful high performance message localization PHP 7.1+ component \nnot only for [Nette](https://nette.org) framework\n\n```bash\ncomposer require rostenkowski/translate\n```\n\n## Translations \n\nTranslations are stored by default in *.neon files in this format:  \n\n```yml\n# simple message\nWelcome!: Vítejte!\n\n# with placeholder\nHi %s!: Ahoj %s! \n\n# multiple forms\nYou have %s points.: \n  - Máte %s bod.\n  - Máte %s body.\n  - Máte %s bodů.\n```\n\n\n### Usage with Nette Framework\n\nPut your translations to `%appDir%/translations` directory as `cs_CZ.neon` etc.\n\n```yml\n# register extension\nextensions:\n  translate: Rostenkowski\\Translate\\Extension\n  \n# configuration\ntranslate:\n  default: cs_CZ\n```\n\n### Advanced options\n\nYou can use special plural form for the count of `0` (zero). \nIn translation source file you can define this form under special index `-1`.\n```yaml\n\"%s problems detected\":\n  -1: \"No problem detected\"\n  - \"%s problem detected\" \n  - \"%s problems detected\" \n``` \n```php\n$translator-\u003euseSpecialZeroForm = true;\n$translator-\u003etranslate('%s problems detected', 0);\n// \"No problem detected\" instead of \"0 problems detected\"\n```\n\n### Usage with plain PHP\n\n```php\n\u003c?php\n\nnamespace App;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Rostenkowski\\Translate\\Translator;\nuse Rostenkowski\\Translate\\NeonDictionary\\NeonDictionaryFactory;\n\n// both translations and cache are in the same directory\n$translator = new Translator(new NeonDictionaryFactory(__DIR__, __DIR__));\n$translator-\u003esetLocale('cs_CZ');\n$translator-\u003etranslate('Welcome!');\n```\n\n## Requirements\n\n- PHP 7.1+\n- nette/di\n- nette/neon\n- nette/safe-stream\n- nette/utils\n- nette/tester\n\n## Contributing\n\n```bash\n# run tests\nvendor/bin/tester -c tests/php.ini tests/\n\n# code coverage report (requires xdebug)\nvendor/bin/tester -c tests/php-coverage.ini --coverage-src src/ --coverage ~/report.html tests/  \n\n# remove test artifacts\nrm -rf tests/temp/cache/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frostenkowski%2Ftranslate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frostenkowski%2Ftranslate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frostenkowski%2Ftranslate/lists"}