DEV Community

Cover image for Introducing the GTranslate Bundle

Introducing the GTranslate Bundle

“Language is the road map of a culture. It tells you where its people come from and where they are going.” - Rita Mae Brown

Index

  1. Introduction
  2. What is the GTranslate Bundle?
  3. Why Does It Matter?
  4. How It Works
    • Default Behavior - Instant Setup
    • Customizing the Widget
    • Manual Placement Example
  5. Stats
  6. Key Takeaways
  7. Interesting Facts
  8. FAQs
  9. Conclusion

Introduction

In today’s global web, multilingual accessibility isn’t a luxury, it’s a necessity. However, using translations in contemporary frameworks might take a lot of effort, particularly if you only want to translate your content fast and don't want to deal with complicated APIs or translation files.

That’s exactly what the AddWeb GTranslate Bundle brings to Symfony developers. A lightweight, plug-and-play integration of the GTranslate.io widget that lets your website speak multiple languages in minutes.

Whether you’re building a content-heavy platform, SaaS dashboard, or portfolio site, the GTranslate Bundle eliminates manual i18n setup pain and provides effortless automatic translation right from Twig templates.

What is the GTranslate Bundle?

The GTranslate Bundle (addweb/gtranslate-bundle) is a Symfony 6.4+/7.x-compatible module that:

  • Integrates Gtranslate.io, a trusted AI-powered website translation widget.
  • Provides a Twig function {{ gtranslate_widget() }} to render customizable translation widgets.
  • Offers simple YAML configuration to define supported languages, default language, and UI preferences.
  • Automatically injects optimized JavaScript for instant translation switching without backend complexity.

This makes multilingual support as easy as:

composer require addweb/gtranslate-bundle

Enter fullscreen mode Exit fullscreen mode

Then simply add:

{{ gtranslate_widget() }}

Enter fullscreen mode Exit fullscreen mode

Why Does It Matter?

Businesses and developers often underestimate how language accessibility impacts engagement, SEO, and trust. According to CSA Research:

  • 65% of users prefer content in their own language, even if it’s of lower quality.
  • 40% won’t buy from websites in other languages.
  • Multilingual websites experience up to 50% longer session durations.

With this bundle, Symfony developers can deliver that global experience without managing translation files or third-party SDK integrations manually.

How It Works

Default Behavior - Instant Setup

Once you install the bundle using

composer require addweb/gtranslate-bundle

Enter fullscreen mode Exit fullscreen mode

Symfony Flex automatically:
Registers the bundle in your project.
Creates a default config file at config/packages/gtranslate.yaml
Makes the Twig function {{ gtranslate_widget() }} available globally.

In your Twig layout:

{{ gtranslate_widget() }}
Enter fullscreen mode Exit fullscreen mode
  • The bundle injects the proper HTML and JS, rendering the GTranslate floating widget automatically.
  • Configuration changes apply instantly. No rebuild or cache-clear needed.

Default Widget Output :

Customizing the Widget

You can modify the default behavior easily in config/packages/gtranslate.yaml

For Example:

gtranslate:
  script_src: 'https://cdn.gtranslate.net/widgets/latest/dwf.js'
  auto_wrapper: true
  settings:
    default_language: 'en'
    languages: ['en','fr','it','es']
    wrapper_selector: '.gtranslate_wrapper'
    switcher_horizontal_position: 'right'
    switcher_vertical_position: 'top'
Enter fullscreen mode Exit fullscreen mode

These changes allow you to:

  • Add or remove supported languages
  • Change widget colors and positions
  • Choose between floating or embedded widget
  • Disable the wrapper and place the switcher manually

OUTPUT:
In English

In Spanish

Expanded dropdown

Manual Placement Example

If you want to render it inside a specific div instead of floating:

<div id="language-switcher">
    {{ gtranslate_widget({ auto_wrapper: false }) }}
</div>
Enter fullscreen mode Exit fullscreen mode

Then add your custom CSS or styling.

Stats

Interesting Facts

FAQs

Q1: How is this different from the Symfony Translation Component?
A: Symfony’s translation component requires manual .xliff or .yaml message catalogs.
Addweb GTranslate Bundle provides automatic, real-time translation using GTranslate.io.

Q2: Does it need a GTranslate API key?
A: No. It uses the public widget (free or premium account). You just configure supported languages.

Q3: Is it compatible with Twig themes?
A: Yes. Works with any Twig-based theme or layout file.

Q4: Can I customize the widget position or color?
A: Absolutely. Use YAML settings for switcher_horizontal_position, colors, and more.

Conclusion

“Translation is that which transforms everything so that nothing changes.” - Günter Grass

The AddWeb GTranslate Bundle is not just another Symfony plugin, it’s a bridge between your brand and the world. It gives every developer the power to build websites that speak to everyone, everywhere, with zero configuration overhead.

You can explore it on Packagist and contribute via GitHub: addweb/gtranslate-bundle

About the Author: Balasaranya Varadhalingam, Software Engineer at AddWebSolution, specializes in PHP, Symfony, and API development.

Top comments (0)