PHPackages                             weglot/translate-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. weglot/translate-bundle

AbandonedArchivedSymfony-bundle[Localization &amp; i18n](/categories/localization)

weglot/translate-bundle
=======================

Seamless integration of Weglot into your Symfony project

0.7.2(7y ago)103.2k[4 issues](https://github.com/weglot/translate-bundle/issues)[3 PRs](https://github.com/weglot/translate-bundle/pulls)MITPHPPHP &gt;=5.5

Since Dec 13Pushed 6y ago3 watchersCompare

[ Source](https://github.com/weglot/translate-bundle)[ Packagist](https://packagist.org/packages/weglot/translate-bundle)[ Docs](https://weglot.com/)[ RSS](/packages/weglot-translate-bundle/feed)WikiDiscussions develop Synced yesterday

READMEChangelogDependencies (1)Versions (25)Used By (0)

[![](https://camo.githubusercontent.com/2abe130a523b0e07d11bf55bb9d4ec42f44512e5844b3fc43b6cb4be632eb8ac/68747470733a2f2f63646e2e7765676c6f742e636f6d2f6c6f676f2f6c6f676f2d686f722e706e67)](https://camo.githubusercontent.com/2abe130a523b0e07d11bf55bb9d4ec42f44512e5844b3fc43b6cb4be632eb8ac/68747470733a2f2f63646e2e7765676c6f742e636f6d2f6c6f676f2f6c6f676f2d686f722e706e67)

Symfony Translate Bundle
========================

[](#symfony-translate-bundle)

[![WeglotSlack](https://camo.githubusercontent.com/074c1ade2fbbc239c1ee37de8addd453d876c47e2d3909e22db8a069a69a500b/68747470733a2f2f7765676c6f742d636f6d6d756e6974792e6e6f772e73682f62616467652e737667)](https://weglot-community.now.sh/)[![Latest Stable Version](https://camo.githubusercontent.com/92852dde087e185e23a1220d60fb0c5659d9f453bc8b0983254f8e05cbadbcc0/68747470733a2f2f706f7365722e707567782e6f72672f7765676c6f742f7472616e736c6174652d62756e646c652f762f737461626c65)](https://packagist.org/packages/weglot/translate-bundle)[![Maintainability](https://camo.githubusercontent.com/df268c7400b18302f60e6a57b53fa9635fffc215f8deef40fdca4f2e1a4f4f71/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f62313738356431653932323538363966336461302f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/weglot/translate-bundle/maintainability)[![License](https://camo.githubusercontent.com/25fe22b1d6281acb3129ef838d3a975581ebbab63e5903ac669ffb5c57f27f61/68747470733a2f2f706f7365722e707567782e6f72672f7765676c6f742f7472616e736c6174652d62756e646c652f6c6963656e7365)](https://packagist.org/packages/weglot/translate-bundle)

Overview
--------

[](#overview)

Seamless integration of Weglot into your Symfony project.

Requirements
------------

[](#requirements)

- PHP version 5.5 and later
- Weglot API Key, starting at [free level](https://dashboard.weglot.com/register?origin=8)

Installation
------------

[](#installation)

You can install the library via [Composer](https://getcomposer.org/). Run the following command:

```
composer require weglot/translate-bundle
```

When 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. Like that it will make bundle registration in `config/bundles.php` &amp; default config creation in `config/packages/weglot_translate.yaml`.

To use the library, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once __DIR__. '/vendor/autoload.php';
```

Getting Started
---------------

[](#getting-started)

### Bundle Register

[](#bundle-register)

#### Symfony 4

[](#symfony-4)

Add Weglot bundle in the `config/bundles.php`:

```
return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    // ... Other bundles ...
    Weglot\TranslateBundle\WeglotTranslateBundle::class => ['all' => true],
];
```

#### Symfony 3 &amp; 2

[](#symfony-3--2)

Add Weglot bundle to `app/AppKernel.php` file:

```
$bundles = array(
    new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
    // ... Other bundles ...
    new Weglot\TranslateBundle\WeglotTranslateBundle(),
);
```

### Quick configuration

[](#quick-configuration)

For Symfony 4, create configuration file under `config/packages/weglot_translate.yaml` and add following content. For Symfony 3 &amp; 2, add following content to your `app/config/config.yaml`.

```
weglot_translate:
    api_key: '%env(WG_API_KEY)%'
    original_language: 'en'
    cache: true
    destination_languages:
        - 'fr'
        - 'de'
```

This is the default configuration file, if you want more default, check next part.

Configuration
-------------

[](#configuration)

As already said, depending on Symfony version, we've different configuration file paths:

- Symfony 4: `config/packages/weglot_translate.yaml`
- Symfony 3 &amp; 2: `app/config/config.yaml`

There is a full configuration file:

```
weglot_translate:
  api_key: '%env(WG_API_KEY)%'
  original_language: 'en'
  cache: false
  destination_languages:
    - 'fr'
    - 'de'
  exclude_blocks:
    - '.material-icons'
```

This is an example of configuration, enter your own API key, your original language and destination languages that you want.

- `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).
- `original_language`: original language is the language of your website before translation.
- `destination_languages`: are the languages that you want your website to be translated into.
- `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.

There is also a non-required parameters:

- `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.

Twig extensions
---------------

[](#twig-extensions)

### Hreflang links

[](#hreflang-links)

Hreflang links are a way to describe your website and to tell webcrawlers (such as search engines) if this page is available in other languages. More details on Google post about hreflang:

You can add them through the Twig function: `weglot_hreflang_render`

Just put the function at the end of your `` tag:

```

        ...

        {{ weglot_hreflang_render() }}

```

### Language button

[](#language-button)

You can add a language button if you're using Twig with function: `weglot_translate_render`

Two layouts exists:

```

{{ weglot_translate_render(1) }}

{{ weglot_translate_render(2) }}
```

### Language code

[](#language-code)

Simple 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.

Here is some examples:

```

{{ 'bg' | language }}

{{ 'bg' | language(false) }}
```

Caching
-------

[](#caching)

We 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).

If you wanna use cache, just add `cache: true` to this bundle configuration. It will use a file-based cache through Symfony `cache.system` service.

To clear the cache, you just have to use the usual pool clear command:

```
$ php bin/console cache:pool:clear weglot_translate.cache

```

Examples
--------

[](#examples)

You'll find a short README with details about example on each repository

- Symfony 4:
- Symfony 3:
- Symfony 2:

About
-----

[](#about)

`translate-bundle` is guided and supported by the Weglot Developer Team.

`translate-bundle` is maintained and funded by Weglot SAS. The names and logos for `translate-bundle` are trademarks of Weglot SAS.

License
-------

[](#license)

[The MIT License (MIT)](LICENSE.txt)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Total

23

Last Release

2912d ago

PHP version history (2 changes)0.2PHP &gt;=5.4

0.5PHP &gt;=5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2648131?v=4)[Floran Pagliai](/maintainers/floranpagliai)[@floranpagliai](https://github.com/floranpagliai)

![](https://avatars.githubusercontent.com/u/38181632?v=4)[Weglot](/maintainers/weglot)[@weglot](https://github.com/weglot)

![](https://www.gravatar.com/avatar/9652f5b144404fa11a80f6b57ed8adf62fa664f5685ac602be9fc7a69f262b06?d=identicon)[bleduc\_weglot](/maintainers/bleduc_weglot)

---

Top Contributors

[![Korbeil](https://avatars.githubusercontent.com/u/944409?v=4)](https://github.com/Korbeil "Korbeil (220 commits)")[![floranpagliai](https://avatars.githubusercontent.com/u/2648131?v=4)](https://github.com/floranpagliai "floranpagliai (25 commits)")[![remyberda](https://avatars.githubusercontent.com/u/22366468?v=4)](https://github.com/remyberda "remyberda (8 commits)")[![mchahed99](https://avatars.githubusercontent.com/u/34678981?v=4)](https://github.com/mchahed99 "mchahed99 (1 commits)")

---

Tags

i18nphpsymfonysymfony-bundlesymfony2symfony3symfony4weglotweglot-integrationphpsymfonylocalizationi18ntranslatelanguagestranslationSymfony2translatorsymfony4symfony3Weglotweglot-integration

### Embed Badge

![Health badge](/badges/weglot-translate-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/weglot-translate-bundle/health.svg)](https://phpackages.com/packages/weglot-translate-bundle)
```

###  Alternatives

[gettext/languages

gettext languages with plural rules

7532.0M12](/packages/gettext-languages)[punic/punic

PHP-Unicode CLDR

1543.0M30](/packages/punic-punic)[fisharebest/localization

A lightweight localization database and translation tools, with data from the CLDR, IANA, ISO, etc.

29101.1k3](/packages/fisharebest-localization)[jrmajor/fluent

Fluent localization system for PHP

2718.0k7](/packages/jrmajor-fluent)[jrmajor/laravel-fluent

Fluent translations for Laravel

208.8k](/packages/jrmajor-laravel-fluent)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
