Skip to content

Happyr/AutoFallbackTranslationBundle

Repository files navigation

Happyr Auto Fallback Translation Bundle

Latest Version Build Status Code Coverage Quality Score Total Downloads

DEPRECATED: Use php-translation/symfony-bundle

This bundle uses Google to translate messages that you have not translated yet. So instead of using a fallback language you get a Google translated string. Sure, Google translate is not optimal but it is way better then using a different language. With this feature you can deploy a new version even before your translators have done their work.

To Install

Run the following in your project root, assuming you have composer set up for your project

composer require happyr/auto-fallback-translation-bundle

Add the bundle to app/AppKernel.php

class AppKernel extends Kernel
{
  public function registerBundles()
  {
    $bundles = array(
        // ...
        new Happyr\AutoFallbackTranslationBundle\HappyrAutoFallbackTranslationBundle(),
    }
  }
}

Configuration

// app/config/config.yml
happyr_auto_fallback_translation:
    enabled: false
    default_locale: en
    translation_service: "google"
    google_key: "%google_server_api_key%"
    http_client: httplug.client.auto_translation
    message_factory: httplug.message_factory # default
    
 // app/config/config_prod.yml
happyr_auto_fallback_translation:
    enabled: true # Only enabled in production

To easier configure the HTTP client and message factory, have a look at HttplugBundle.