<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="lexik_translation.translator.class">Lexik\Bundle\TranslationBundle\Translation\Translator</parameter>
        <parameter key="lexik_translation.loader.database.class">Lexik\Bundle\TranslationBundle\Translation\Loader\DatabaseLoader</parameter>
        <parameter key="lexik_translation.trans_unit.manager.class">Lexik\Bundle\TranslationBundle\Manager\TransUnitManager</parameter>
        <parameter key="lexik_translation.file.manager.class">Lexik\Bundle\TranslationBundle\Manager\FileManager</parameter>
        <parameter key="lexik_translation.locale.manager.class">Lexik\Bundle\TranslationBundle\Manager\LocaleManager</parameter>
        <parameter key="lexik_translation.importer.file.class">Lexik\Bundle\TranslationBundle\Translation\Importer\FileImporter</parameter>
        <parameter key="lexik_translation.exporter_collector.class">Lexik\Bundle\TranslationBundle\Translation\Exporter\ExporterCollector</parameter>
        <parameter key="lexik_translation.exporter.xliff.class">Lexik\Bundle\TranslationBundle\Translation\Exporter\XliffExporter</parameter>
        <parameter key="lexik_translation.exporter.json.class">Lexik\Bundle\TranslationBundle\Translation\Exporter\JsonExporter</parameter>
        <parameter key="lexik_translation.exporter.yml.class">Lexik\Bundle\TranslationBundle\Translation\Exporter\YamlExporter</parameter>
        <parameter key="lexik_translation.exporter.php.class">Lexik\Bundle\TranslationBundle\Translation\Exporter\PhpExporter</parameter>

        <parameter key="lexik_translation.orm.translation_storage.class">Lexik\Bundle\TranslationBundle\Storage\DoctrineORMStorage</parameter>
        <parameter key="lexik_translation.orm.listener.class">Lexik\Bundle\TranslationBundle\Storage\Listener\DoctrineORMListener</parameter>
        <parameter key="lexik_translation.orm.trans_unit.class">Lexik\Bundle\TranslationBundle\Entity\TransUnit</parameter>
        <parameter key="lexik_translation.orm.translation.class">Lexik\Bundle\TranslationBundle\Entity\Translation</parameter>
        <parameter key="lexik_translation.orm.file.class">Lexik\Bundle\TranslationBundle\Entity\File</parameter>

        <parameter key="lexik_translation.mongodb.translation_storage.class">Lexik\Bundle\TranslationBundle\Storage\DoctrineMongoDBStorage</parameter>
        <parameter key="lexik_translation.mongodb.trans_unit.class">Lexik\Bundle\TranslationBundle\Document\TransUnit</parameter>
        <parameter key="lexik_translation.mongodb.translation.class">Lexik\Bundle\TranslationBundle\Document\Translation</parameter>
        <parameter key="lexik_translation.mongodb.file.class">Lexik\Bundle\TranslationBundle\Document\File</parameter>

        <parameter key="lexik_translation.propel.translation_storage.class">Lexik\Bundle\TranslationBundle\Storage\PropelStorage</parameter>
        <parameter key="lexik_translation.propel.trans_unit.class">Lexik\Bundle\TranslationBundle\Propel\TransUnit</parameter>
        <parameter key="lexik_translation.propel.translation.class">Lexik\Bundle\TranslationBundle\Propel\Translation</parameter>
        <parameter key="lexik_translation.propel.file.class">Lexik\Bundle\TranslationBundle\Propel\File</parameter>

        <parameter key="lexik_translation.data_grid.formatter.class">Lexik\Bundle\TranslationBundle\Util\DataGrid\DataGridFormatter</parameter>
        <parameter key="lexik_translation.data_grid.request_handler.class">Lexik\Bundle\TranslationBundle\Util\DataGrid\DataGridRequestHandler</parameter>

        <parameter key="lexik_translation.overview.stats_aggregator.class">Lexik\Bundle\TranslationBundle\Util\Overview\StatsAggregator</parameter>

        <parameter key="lexik_translation.form.handler.trans_unit.class">Lexik\Bundle\TranslationBundle\Form\Handler\TransUnitFormHandler</parameter>

        <parameter key="lexik_translation.listener.get_database_resources.class">Lexik\Bundle\TranslationBundle\EventDispatcher\GetDatabaseResourcesListener</parameter>
        <parameter key="lexik_translation.listener.clean_translation_cache.class">Lexik\Bundle\TranslationBundle\EventDispatcher\CleanTranslationCacheListener</parameter>

        <parameter key="lexik_translation.token_finder.class">Lexik\Bundle\TranslationBundle\Util\Profiler\TokenFinder</parameter>

        <parameter key="lexik_translation.command.import_translations.class">Lexik\Bundle\TranslationBundle\Command\ImportTranslationsCommand</parameter>
        <parameter key="lexik_translation.command.export_translations.class">Lexik\Bundle\TranslationBundle\Command\ExportTranslationsCommand</parameter>

        <parameter key="lexik_translation.controller.translation.class">Lexik\Bundle\TranslationBundle\Controller\TranslationController</parameter>
        <parameter key="lexik_translation.controller.rest.class">Lexik\Bundle\TranslationBundle\Controller\RestController</parameter>

        <parameter key="lexik_translation.importer.case_insensitive">false</parameter>
        <parameter key="lexik_translation.token_finder.limit">15</parameter>

        <parameter key="lexik_translation.translator.options" type="collection">
            <parameter key="cache_dir">%kernel.cache_dir%/translations</parameter>
            <parameter key="debug">%kernel.debug%</parameter>
        </parameter>
    </parameters>

    <services>
        <service id="Lexik\Bundle\TranslationBundle\Translation\Translator">
            <argument key="$container" type="service" id="service_container"/>
            <argument key="$formatter" type="service" id="translator.formatter.default" />
            <argument key="$defaultLocale" id="%kernel.default_locale%" />
            <argument key="$loaderIds" type="collection"></argument>
            <argument key="$options" type="collection" >
                <argument key="cache_dir">%kernel.cache_dir%</argument>
            </argument>
        </service>
        <service id="lexik_translation.translator" alias="Lexik\Bundle\TranslationBundle\Translation\Translator" public="true"/>
        <service id="Lexik\Bundle\TranslationBundle\Storage\StorageInterface" alias="lexik_translation.translation_storage" />

        <!-- Loader -->
        <service id="Lexik\Bundle\TranslationBundle\Translation\Loader" class="%lexik_translation.loader.database.class%">
            <argument type="service" id="lexik_translation.translation_storage" />
            <tag name="translation.loader" alias="database" />
        </service>
        <!-- Managers -->
        <service id="lexik_translation.trans_unit.manager" class="%lexik_translation.trans_unit.manager.class%" public="true">
            <argument type="service" id="lexik_translation.translation_storage" />
            <argument type="service" id="lexik_translation.file.manager" />
            <argument>%kernel.project_dir%</argument>
        </service>
        <service id="Lexik\Bundle\TranslationBundle\Manager\TransUnitManagerInterface" alias="lexik_translation.trans_unit.manager"/>

        <service id="lexik_translation.file.manager" class="%lexik_translation.file.manager.class%">
            <argument type="service" id="lexik_translation.translation_storage" />
            <argument>%kernel.project_dir%</argument>
        </service>
        <service id="Lexik\Bundle\TranslationBundle\Manager\FileManagerInterface" alias="lexik_translation.file.manager" />

        <service id="Lexik\Bundle\TranslationBundle\Manager\LocaleManager" class="%lexik_translation.locale.manager.class%" public="true">
            <argument>%lexik_translation.managed_locales%</argument>
        </service>
        <service id="Lexik\Bundle\TranslationBundle\Manager\LocaleManagerInterface" alias="Lexik\Bundle\TranslationBundle\Manager\LocaleManager" public="true" />

        <!-- Importer -->
        <service id="Lexik\Bundle\TranslationBundle\Translation\Importer\FileImporter" class="%lexik_translation.importer.file.class%" >
            <argument type="collection" /> <!-- translation loaders -->
            <argument type="service" id="lexik_translation.translation_storage" />
            <argument type="service" id="lexik_translation.trans_unit.manager" />
            <argument type="service" id="lexik_translation.file.manager" />
            <call method="setCaseInsensitiveInsert">
                <argument>%lexik_translation.importer.case_insensitive%</argument>
            </call>
        </service>
        <service id="lexik_translation.importer.file" alias="Lexik\Bundle\TranslationBundle\Translation\Importer\FileImporter" public="true"/>
        <!-- Exporter -->
        <service id="Lexik\Bundle\TranslationBundle\Translation\Exporter\ExporterCollector" class="%lexik_translation.exporter_collector.class%"/>
        <service id="lexik_translation.exporter_collector" alias="Lexik\Bundle\TranslationBundle\Translation\Exporter\ExporterCollector" public="true"/>

        <service id="Lexik\Bundle\TranslationBundle\Translation\Exporter\XliffExporter" class="%lexik_translation.exporter.xliff.class%">
            <tag name="lexik_translation.exporter" alias="xlf" />
        </service>
        <service id="lexik_translation.exporter.xliff" alias="Lexik\Bundle\TranslationBundle\Translation\Exporter\XliffExporter" public="true"/>

        <service id="Lexik\Bundle\TranslationBundle\Translation\Exporter\JsonExporter" class="%lexik_translation.exporter.json.class%">
            <argument>%lexik_translation.exporter.json.hierarchical_format%</argument>
            <tag name="lexik_translation.exporter" alias="json" />
        </service>
        <service id="lexik_translation.exporter.json" alias="Lexik\Bundle\TranslationBundle\Translation\Exporter\JsonExporter" public="true"/>

        <service id="Lexik\Bundle\TranslationBundle\Translation\Exporter\YamlExporter" class="%lexik_translation.exporter.yml.class%">
            <argument>%lexik_translation.exporter.yml.use_tree%</argument>
            <tag name="lexik_translation.exporter" alias="yml" />
        </service>
        <service id="lexik_translation.exporter.yml" alias="Lexik\Bundle\TranslationBundle\Translation\Exporter\YamlExporter"/>

        <service id="Lexik\Bundle\TranslationBundle\Translation\Exporter\PhpExporter" class="%lexik_translation.exporter.php.class%">
            <tag name="lexik_translation.exporter" alias="php" />
        </service>
        <service id="lexik_translation.exporter.php" alias="Lexik\Bundle\TranslationBundle\Translation\Exporter\PhpExporter"/>

        <!-- Data grid -->
        <service id="lexik_translation.data_grid.formatter" class="%lexik_translation.data_grid.formatter.class%" public="true">
            <argument type="service" id="Lexik\Bundle\TranslationBundle\Manager\LocaleManagerInterface" />
            <argument>%lexik_translation.storage.type%</argument>
        </service>
        <service id="Lexik\Bundle\TranslationBundle\Util\DataGrid\DataGridFormatter" alias="lexik_translation.data_grid.formatter" />

        <service id="lexik_translation.data_grid.request_handler" class="%lexik_translation.data_grid.request_handler.class%" public="true">
            <argument type="service" id="lexik_translation.trans_unit.manager" />
            <argument type="service" id="lexik_translation.file.manager" />
            <argument type="service" id="lexik_translation.translation_storage" />
            <argument type="service" id="Lexik\Bundle\TranslationBundle\Manager\LocaleManagerInterface" />
            <call method="setCreateMissing">
                <argument>%lexik_translation.dev_tools.create_missing%</argument>
            </call>
            <call method="setDefaultFileFormat">
                <argument>%lexik_translation.dev_tools.file_format%</argument>
            </call>
        </service>
        <service id="Lexik\Bundle\TranslationBundle\Util\DataGrid\DataGridRequestHandler" alias="lexik_translation.data_grid.request_handler" />

        <!-- Overview -->
        <service id="lexik_translation.overview.stats_aggregator" class="%lexik_translation.overview.stats_aggregator.class%" public="true">
            <argument type="service" id="lexik_translation.translation_storage" />
            <argument type="service" id="Lexik\Bundle\TranslationBundle\Manager\LocaleManagerInterface" />
        </service>
        <service id="%lexik_translation.overview.stats_aggregator.class%" alias="lexik_translation.overview.stats_aggregator" />

        <!-- Form -->
        <service id="lexik_translation.form.handler.trans_unit" class="%lexik_translation.form.handler.trans_unit.class%" public="true" autoconfigure="true" autowire="true">
            <argument key="$rootDir" >%kernel.project_dir%</argument>
        </service>
        <service id="Lexik\Bundle\TranslationBundle\Form\Handler\TransUnitFormHandler" alias="lexik_translation.form.handler.trans_unit" />

        <!-- Listener -->
        <service id="Lexik\Bundle\TranslationBundle\EventDispatcher\Event\GetDatabaseResourcesEvent" class="%lexik_translation.listener.get_database_resources.class%">
            <argument type="service" id="lexik_translation.translation_storage" />
            <argument>%lexik_translation.storage.type%</argument>
            <tag name="kernel.event_listener" event="Lexik\Bundle\TranslationBundle\EventDispatcher\Event\GetDatabaseResourcesEvent" method="onGetDatabaseResources"  />
        </service>

        <!-- Command -->
        <service id="Lexik\Bundle\TranslationBundle\Command\ImportTranslationsCommand" autowire="true" class="%lexik_translation.command.import_translations.class%">
            <tag name="console.command" />
        </service>

        <service id="Lexik\Bundle\TranslationBundle\Command\ExportTranslationsCommand" autowire="true" class="%lexik_translation.command.export_translations.class%">
            <argument key="$projectDir" >%kernel.project_dir%</argument>
            <tag name="console.command" />
        </service>

        <!-- Controller -->
        <service id="Lexik\Bundle\TranslationBundle\Controller\RestController" class="%lexik_translation.controller.rest.class%" public="true" autowire="true" autoconfigure="true">
        </service>

        <service id="Lexik\Bundle\TranslationBundle\Controller\TranslationController" class="%lexik_translation.controller.translation.class%" public="true" autowire="true" autoconfigure="true">
        </service>
    </services>
</container>
