Symfony bundle to use drupal transliteration (eg in doctrine sluggable extension).

Installs: 10 305

Dependents: 0

Suggesters: 0

Stars: 3

Watchers: 1

Forks: 0

Open Issues: 0

Type: symfony-bundle

v1.0.2 2013-01-06 09:22 UTC


This bundle provides a better transliterator than the one included in Doctrine Extensions. This is useful for the Sluggable behavior if you are using a non alphabetic based language. The one bundled in Doctrine extensions works fine for many languages but I found limitations with Chinese at least. Drupal provides a more advanced one.

Transliteration is the process of changing text from 北京 to Bei Jing. So that it can be url formatted afterwards.

Through the deps files add:


Run your vendor script ./bin/vendors install.

In your autoload.php register the Khepin namespace:

    // ...
    'Khepin'           => __DIR__.'/../vendor/bundles',
    // ...

There is no real need to register the bundle as all it provides is a class with static methods to transliterate strings. Having it autoloaded is enough.


The bundle provides a Transliterator class with two methods:

  • One to just transliterate the text: Khepin\DrupalTransliteratorBundle\Transliterator::transliterate
  • One that is compatible directly with the declaration in doctrine extensions Khepin\DrupalTransliteratorBundle\Transliterator::sluggableTransliterate

The bundle also overrides the standard Doctrine Extensions Sluggable listener so that it uses this transliteration method rather than the standard one. In order to use it, change your DoctrineExtensionBundle to use the new listener:

        sluggable: Khepin\DrupalTransliteratorBundle\Listener\SluggableListener
            sluggable: true
    # or
            sluggable: true