{"id":17948826,"url":"https://github.com/eko/googletranslatebundle","last_synced_at":"2025-03-24T22:35:38.237Z","repository":{"id":9351214,"uuid":"11202537","full_name":"eko/GoogleTranslateBundle","owner":"eko","description":"A Symfony bundle to deals with Google Translate API","archived":false,"fork":false,"pushed_at":"2018-07-17T14:22:30.000Z","size":73,"stargazers_count":43,"open_issues_count":2,"forks_count":23,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-19T05:06:57.061Z","etag":null,"topics":["detect-language","detector","language","symfony","symfony-bundle","translation-service"],"latest_commit_sha":null,"homepage":null,"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/eko.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":"2013-07-05T15:20:34.000Z","updated_at":"2024-05-21T08:30:31.000Z","dependencies_parsed_at":"2022-09-22T14:41:36.091Z","dependency_job_id":null,"html_url":"https://github.com/eko/GoogleTranslateBundle","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2FGoogleTranslateBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2FGoogleTranslateBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2FGoogleTranslateBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2FGoogleTranslateBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eko","download_url":"https://codeload.github.com/eko/GoogleTranslateBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245366205,"owners_count":20603438,"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":["detect-language","detector","language","symfony","symfony-bundle","translation-service"],"created_at":"2024-10-29T09:10:13.435Z","updated_at":"2025-03-24T22:35:33.208Z","avatar_url":"https://github.com/eko.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"GoogleTranslateBundle\n=====================\n\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/41d3d242-a0fe-424c-8cb1-65327f89df11/big.png)](https://insight.sensiolabs.com/projects/41d3d242-a0fe-424c-8cb1-65327f89df11)\n\n[![Build Status](https://secure.travis-ci.org/eko/GoogleTranslateBundle.png?branch=master)](http://travis-ci.org/eko/GoogleTranslateBundle)\n[![Latest Stable Version](https://poser.pugx.org/eko/GoogleTranslateBundle/version.png)](https://packagist.org/packages/eko/GoogleTranslateBundle)\n[![Total Downloads](https://poser.pugx.org/eko/GoogleTranslateBundle/d/total.png)](https://packagist.org/packages/eko/GoogleTranslateBundle)\n\nFeatures\n--------\n\n * Detect language used for a string\n * Translate a string from a source language to a target one\n * Translate a string into a target language by using language auto-detection (consume 1 more API call)\n * Retrieve all languages available on API and obtain language names in a given language\n * Profile detector / translate / languages list API calls in the Symfony profiler!\n\nInstallation\n------------\n\nAdd the bundle to your `composer.json` file:\n\n```json\n{\n    \"require\" :  {\n        \"eko/googletranslatebundle\": \"dev-master\"\n    }\n}\n```\n\nAdd this to app/AppKernel.php\n\n```php\n\u003c?php\n    public function registerBundles()\n    {\n        $bundles = array(\n            ...\n            new Eko\\GoogleTranslateBundle\\EkoGoogleTranslateBundle(),\n        );\n\n        ...\n\n        return $bundles;\n    }\n```\n\nConfiguration\n-------------\n\n### Edit app/config.yml\n\nThe following configuration lines are required:\n\n```yaml\neko_google_translate:\n    api_key: \u003cyour key api string\u003e\n```\n\nUsages\n------\n\n### Detect a string language\n\nRetrieve the detector service and call the `detect()` method:\n\n```php\n$detector = $this-\u003eget('eko.google_translate.detector');\n$value = $detector-\u003edetect('Hi, this is my string to detect!');\n// This will return 'en'\n```\n\n### Translate a string\n\nRetrieve the translator service and call the `translate()` method:\n\n```php\n$translator = $this-\u003eget('eko.google_translate.translator');\n$value = $translator-\u003etranslate('Hi, this is my text to detect!', 'fr', 'en');\n// This will return 'Salut, ceci est mon texte à détecter!'\n```\n\n### Translate a string from unknown language (use detector)\n\nRetrieve the translator service and call the `translate()` method without the source (third) parameter:\n\n```php\n$translator = $this-\u003eget('eko.google_translate.translator');\n$value = $translator-\u003etranslate('Hi, this is my text to detect!', 'fr');\n// This will return 'Salut, ceci est mon texte à détecter!'\n```\n\n### Translate multiple strings\n\nRetrieve the translator service and call the `translate()` method with an array of your strings:\n\n```php\n$translator = $this-\u003eget('eko.google_translate.translator');\n$value = $translator-\u003etranslate(array('Hi', 'This is my second text to detect!'), 'fr', 'en');\n// This will return the following array:\n// array(\n//     0 =\u003e 'Salut',\n//     1 =\u003e 'Ceci est mon second texte à détecter !',\n// )\n```\n\nNote that you can also use an \"economic mode\" to translate multiple strings in a single request which is better for your application performances.\n\nYour translations will be concatenated in one single Google request. To use it, simply add `true` to the last argument:\n\n```php\n$translator = $this-\u003eget('eko.google_translate.translator');\n$value = $translator-\u003etranslate(array('Hi', 'This is my second text to detect!'), 'fr', 'en', true);\n// This will return the following array:\n// array(\n//     0 =\u003e 'Salut',\n//     1 =\u003e 'Ceci est mon second texte à détecter !',\n// )\n```\n\n### Obtain all languages codes available\n\nRetrieve the languages service and call the `get()` method without any argument:\n\n```php\n$languages = $this-\u003eget('eko.google_translate.languages')-\u003eget();\n// This will return:\n// array(\n//     array('language' =\u003e 'en'),\n//     array('language' =\u003e 'fr'),\n//     ...\n// )\n```\n\n### Obtain all languages codes available with their names translated\n\nRetrieve the languages service and call the `get()` method with a target language argument:\n\n```php\n$languages = $this-\u003eget('eko.google_translate.languages')-\u003eget('fr');\n// This will return:\n// array(\n//     array('language' =\u003e 'en', 'name' =\u003e 'Anglais'),\n//     array('language' =\u003e 'fr', 'name' =\u003e 'Français'),\n//     ...\n// )\n```\n\n\nNotice: this will consume a detector API call.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feko%2Fgoogletranslatebundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feko%2Fgoogletranslatebundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feko%2Fgoogletranslatebundle/lists"}