happyr/auto-fallback-translation-bundle

This package is abandoned and no longer maintained. The author suggests using the php-translation/symfony-bundle package instead.

Make sure to use a translation service like Bing or Google to translate your missing messages

1.0.1 2016-11-12 20:13 UTC

This package is auto-updated.

Last update: 2022-02-01 12:53:51 UTC


README

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.