{"id":15076624,"url":"https://github.com/weglot/translate-bundle","last_synced_at":"2025-10-05T11:31:20.723Z","repository":{"id":57079597,"uuid":"129758067","full_name":"weglot/translate-bundle","owner":"weglot","description":"Translate your Symfony website easily.","archived":true,"fork":false,"pushed_at":"2019-10-20T17:00:36.000Z","size":170,"stargazers_count":10,"open_issues_count":7,"forks_count":0,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-09-29T11:48:12.758Z","etag":null,"topics":["i18n","php","symfony","symfony-bundle","symfony2","symfony3","symfony4","weglot","weglot-integration"],"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/weglot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-16T14:40:06.000Z","updated_at":"2023-01-27T23:38:00.000Z","dependencies_parsed_at":"2022-08-24T13:10:26.993Z","dependency_job_id":null,"html_url":"https://github.com/weglot/translate-bundle","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/weglot/translate-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weglot%2Ftranslate-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weglot%2Ftranslate-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weglot%2Ftranslate-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weglot%2Ftranslate-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weglot","download_url":"https://codeload.github.com/weglot/translate-bundle/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weglot%2Ftranslate-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278445725,"owners_count":25988042,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["i18n","php","symfony","symfony-bundle","symfony2","symfony3","symfony4","weglot","weglot-integration"],"created_at":"2024-09-25T04:00:35.315Z","updated_at":"2025-10-05T11:31:20.471Z","avatar_url":"https://github.com/weglot.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- logo --\u003e\n\u003cimg src=\"https://cdn.weglot.com/logo/logo-hor.png\" height=\"40\" /\u003e\n\n# Symfony Translate Bundle\n\n\u003c!-- tags --\u003e\n[![WeglotSlack](https://weglot-community.now.sh/badge.svg)](https://weglot-community.now.sh/)\n[![Latest Stable Version](https://poser.pugx.org/weglot/translate-bundle/v/stable)](https://packagist.org/packages/weglot/translate-bundle)\n[![Maintainability](https://api.codeclimate.com/v1/badges/b1785d1e9225869f3da0/maintainability)](https://codeclimate.com/github/weglot/translate-bundle/maintainability)\n[![License](https://poser.pugx.org/weglot/translate-bundle/license)](https://packagist.org/packages/weglot/translate-bundle)\n\n## Overview\nSeamless integration of Weglot into your Symfony project.\n\n## Requirements\n- PHP version 5.5 and later\n- Weglot API Key, starting at [free level](https://dashboard.weglot.com/register?origin=8)\n\n## Installation\nYou can install the library via [Composer](https://getcomposer.org/). Run the following command:\n\n```bash\ncomposer require weglot/translate-bundle\n```\n\nWhen you require the bundle with `symfony/flex` (available for `symfony/symfony:^4.0`) it should ask you if you wanna execute a recipe, tell yes.\nLike that it will make bundle registration in `config/bundles.php` \u0026 default config creation in `config/packages/weglot_translate.yaml`.\n\nTo use the library, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):\n\n```php\nrequire_once __DIR__. '/vendor/autoload.php';\n```\n\n## Getting Started\n\n### Bundle Register\n\n#### Symfony 4\n\nAdd Weglot bundle in the `config/bundles.php`:\n```php\nreturn [\n    Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle::class =\u003e ['all' =\u003e true],\n    // ... Other bundles ...\n    Weglot\\TranslateBundle\\WeglotTranslateBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n#### Symfony 3 \u0026 2\n\nAdd Weglot bundle to `app/AppKernel.php` file:\n```php\n$bundles = array(\n    new Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle(),\n    // ... Other bundles ...\n    new Weglot\\TranslateBundle\\WeglotTranslateBundle(),\n);\n```\n\n### Quick configuration\n\nFor Symfony 4, create configuration file under `config/packages/weglot_translate.yaml` and add following content.\nFor Symfony 3 \u0026 2, add following content to your `app/config/config.yaml`.\n\n```yaml\nweglot_translate:\n    api_key: '%env(WG_API_KEY)%'\n    original_language: 'en'\n    cache: true\n    destination_languages:\n        - 'fr'\n        - 'de'\n```\n\nThis is the default configuration file, if you want more default, check next part.\n\n## Configuration\n\nAs already said, depending on Symfony version, we've different configuration file paths:\n- Symfony 4: `config/packages/weglot_translate.yaml`\n- Symfony 3 \u0026 2: `app/config/config.yaml`\n\nThere is a full configuration file:\n\n```yaml\nweglot_translate:\n  api_key: '%env(WG_API_KEY)%'\n  original_language: 'en'\n  cache: false\n  destination_languages:\n    - 'fr'\n    - 'de'\n  exclude_blocks:\n    - '.material-icons'\n```\n\nThis is an example of configuration, enter your own API key, your original language and destination languages that you want.\n- `api_key`: is your personal API key. You can get an API Key by signing up on [Weglot](https://dashboard.weglot.com/register?origin=8).\n- `original_language`: original language is the language of your website before translation.\n- `destination_languages`: are the languages that you want your website to be translated into.\n- `cache`: if you wanna use cache or not. It's not a required field and set as false by default. Look at [Caching part](#caching) for more details.\n\nThere is also a non-required parameters:\n- `exclude_blocks`: You can list here all blocks you don't want to be translated. In this example, we won't translate all DOM tags with \"material-icons\" class.\n\n## Twig extensions\n\n### Hreflang links\n\nHreflang links are a way to describe your website and to tell webcrawlers (such as search engines) if this page is available in other languages.\nMore details on Google post about hreflang: https://support.google.com/webmasters/answer/189077\n\nYou can add them through the Twig function: `weglot_hreflang_render`\n\nJust put the function at the end of your `\u003chead\u003e` tag:\n```twig\n\u003chtml\u003e\n    \u003chead\u003e\n        ...\n\n        {{ weglot_hreflang_render() }}\n    \u003c/head\u003e\n```\n\n### Language button\n\nYou can add a language button if you're using Twig with function: `weglot_translate_render`\n\nTwo layouts exists:\n```twig\n\u003c!-- first layout --\u003e\n{{ weglot_translate_render(1) }}\n\n\u003c!-- second layout --\u003e\n{{ weglot_translate_render(2) }}\n```\n\n### Language code\n\nSimple filter to convert ISO 639-1 code to full language name. It can takes one boolean parameter that allow you to choose having english name or original language name.\n\nHere is some examples:\n```twig\n\u003c!-- Will return english name for given code, here: \"Bulgarian\" --\u003e\n{{ 'bg' | language }}\n\n\u003c!-- Will return original name for given code, here: \"български\" --\u003e\n{{ 'bg' | language(false) }}\n```\n\n## Caching\n\nWe implemented usage of cache pool service for both Symfony 4 and Symfony 3 (`symfony/cache` bundle was released with Symfony 3, so there is no compatibility for Symfony 2).\n\nIf you wanna use cache, just add `cache: true` to this bundle configuration. It will use a file-based cache through Symfony `cache.system` service.\n\nTo clear the cache, you just have to use the usual pool clear command:\n```\n$ php bin/console cache:pool:clear weglot_translate.cache\n```\n\n## Examples\n\nYou'll find a short README with details about example on each repository\n\n- Symfony 4: https://github.com/weglot/translate-bundle-example-sf4\n- Symfony 3: https://github.com/weglot/translate-bundle-example-sf3\n- Symfony 2: https://github.com/weglot/translate-bundle-example-sf2\n\n## About\n`translate-bundle` is guided and supported by the Weglot Developer Team.\n\n`translate-bundle` is maintained and funded by Weglot SAS.\nThe names and logos for `translate-bundle` are trademarks of Weglot SAS.\n\n## License\n[The MIT License (MIT)](LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweglot%2Ftranslate-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweglot%2Ftranslate-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweglot%2Ftranslate-bundle/lists"}