parameters:
    oro_translation.entity.language.class:                      Oro\Bundle\TranslationBundle\Entity\Language
    oro_translation.entity.translation.class:                   Oro\Bundle\TranslationBundle\Entity\Translation
    oro_translation.entity.translation_key.class:               Oro\Bundle\TranslationBundle\Entity\TranslationKey

    translator.class:                                           Oro\Bundle\TranslationBundle\Translation\Translator
    oro_translation.translation_walker.class:                   Gedmo\Translatable\Query\TreeWalker\TranslationWalker
    oro_translation.controller.class:                           Oro\Bundle\TranslationBundle\Controller\Controller
    oro_translation.extractor.php_code_extractor.class:         Oro\Bundle\TranslationBundle\Extractor\PhpCodeExtractor
    oro_translation.empty_array.loader.class:                   Oro\Bundle\TranslationBundle\Translation\EmptyArrayLoader

    oro_translation.dynamic_translation.metadata.cache.class:   Oro\Bundle\TranslationBundle\Translation\DynamicTranslationMetadataCache

    oro_translation.service_provider.class:                     Oro\Bundle\TranslationBundle\Provider\TranslationServiceProvider
    oro_translation.statistic_provider.class:                   Oro\Bundle\TranslationBundle\Provider\TranslationStatisticProvider
    oro_translation.crowdin.adapter.class:                      Oro\Bundle\TranslationBundle\Provider\CrowdinAdapter
    oro_translation.oro_translation.adapter.class:              Oro\Bundle\TranslationBundle\Provider\OroTranslationAdapter
    oro_translation.guzzle_client.class:                        Guzzle\Http\Client

    oro_translation.twig.translation.extension.class:           Oro\Bundle\TranslationBundle\Twig\TranslationExtension
    oro_translation.packages_provider.class:                    Oro\Bundle\TranslationBundle\Provider\PackagesProvider
    oro_translation.event_listener.language_change.class:       Oro\Bundle\TranslationBundle\EventListener\LanguageChangeListener

    oro_translation.strategy.provider.class:                    Oro\Bundle\TranslationBundle\Strategy\TranslationStrategyProvider
    oro_translation.strategy.default.class:                     Oro\Bundle\TranslationBundle\Strategy\DefaultTranslationStrategy

services:
    oro_translation.controller:
        class: %oro_translation.controller.class%
        arguments:
            - '@translator.default'
            - '@templating'
            - OroTranslationBundle:Translation:translation.js.twig
            - ""
        lazy: true

    oro_translation.extractor.php_code_extractor:
        class: %oro_translation.extractor.php_code_extractor.class%
        arguments:
            - '@service_container'
        tags:
            - { name: translation.extractor, alias: oro_translation_php_extractor }

    oro_translation.service_provider:
        class: %oro_translation.service_provider.class%
        arguments:
            - '@oro_translation.uploader.default_adapter'
            - '@oro_translation.js_dumper'
            - '@translation.loader'
            - '@oro_translation.database_translation.persister'
            - %kernel.cache_dir%
        lazy: true

    oro_translation.statistic_provider:
        class: %oro_translation.statistic_provider.class%
        arguments:
            - '@oro_translation.cache'
            - '@oro_translation.oro_translation_adapter'
            - '@oro_translation.packages_provider'

    # guzzle http client for crowdin
    oro_translation.guzzle_crowdin_client:
        class: %oro_translation.guzzle_client.class%
        arguments:
            - %oro_translation.api.crowdin.endpoint%
        lazy: true

    # guzzle http client for oro proxy
    oro_translation.guzzle_oro_client:
        class: %oro_translation.guzzle_client.class%
        arguments:
            - %oro_translation.api.oro_service.endpoint%
        lazy: true

    oro_translation.uploader.crowdin_adapter:
        class: %oro_translation.crowdin.adapter.class%
        arguments:
            - '@oro_translation.guzzle_crowdin_client'

    oro_translation.oro_translation_adapter:
        class: %oro_translation.oro_translation.adapter.class%
        arguments:
            - '@oro_translation.guzzle_oro_client'
        calls:
            - [ setApiKey, [ %oro_translation.api.oro_service.key% ] ]
            - [ setLogger, [ '@logger' ] ]

    oro_translation.database_translation.metadata.cache:
        class: %oro_translation.dynamic_translation.metadata.cache.class%
        arguments:
            - '@oro_translation.database_translation.metadata.cache_impl'

    oro_translation.database_translation.metadata.cache_impl:
        public: false
        parent: oro.cache.abstract
        calls:
            - [ setNamespace, [ 'oro_db_trans_metadata' ] ]

    oro_translation.database_translation.persister:
        class: 'Oro\Bundle\TranslationBundle\Translation\DatabasePersister'
        arguments:
            - '@doctrine'
            - '@oro_translation.manager.translation'

    oro_translation.database_translation.loader:
        class: 'Oro\Bundle\TranslationBundle\Translation\OrmTranslationLoader'
        arguments:
            - '@doctrine'
        tags:
            - { name: translation.loader, alias: oro_database_translation }

    oro_translation.empty_array.loader:
        class: %oro_translation.empty_array.loader.class%

    oro_translation.cache:
        parent: oro.cache.abstract
        calls:
            - [setNamespace, [ 'oro_trans' ] ]

    oro_translation.resource.cache:
        public: false
        class: Doctrine\Common\Cache\ArrayCache

    oro_translation.js_dumper:
        class: 'Oro\Bundle\TranslationBundle\Provider\JsTranslationDumper'
        arguments:
            - '@oro_translation.controller'
            - '@router'
            - %oro_translation.js_translation.domains%
            - %kernel.root_dir%
            - '@oro_translation.provider.language'
        lazy: true

    oro_translation.twig.translation.extension:
        class: %oro_translation.twig.translation.extension.class%
        arguments:
            - %oro_translation.debug_translator%
        tags:
            - { name: twig.extension }

    oro_translation.distribution.package_manager.link:
        tags:
            - { name: oro_service_link,  service: oro_distribution.package_manager }

    oro_translation.packages_provider:
        class: %oro_translation.packages_provider.class%
        arguments:
            - '@oro_translation.distribution.package_manager.link'
            - %kernel.bundles%
            - %kernel.root_dir%
            - %oro_distribution.composer_cache_home%

    oro_translation.query_hint.translatable:
        public: false
        abstract: true
        tags:
            -
                name: oro_entity.query_hint
                hint: oro_translation.translatable
                alias: HINT_TRANSLATABLE
                output_walker: %oro_translation.translation_walker.class%

    oro_translation.event_listener.language_change:
        class: %oro_translation.event_listener.language_change.class%
        arguments:
            - '@oro_translation.database_translation.metadata.cache'
        tags:
            - { name: kernel.event_listener, event: oro_config.update_after, method: onConfigUpdate }

    oro_translation.event_listener.translation:
        class: 'Oro\Bundle\TranslationBundle\EventListener\TranslationListener'
        lazy: true
        arguments:
            - '@oro_translation.database_translation.metadata.cache'
            - 'import.language_translations_import_from_csv'
        tags:
            - {name: kernel.event_listener, event: oro.import_export.after_job_execution, method: onAfterImportTranslations}

    oro_translation.strategy.default:
        class: '%oro_translation.strategy.default.class%'
        public: false
        arguments:
            - '@oro_translation.provider.language'
            - '%installed%'

    oro_translation.strategy.provider:
        class: '%oro_translation.strategy.provider.class%'
        arguments:
            - '@oro_translation.strategy.default'

    oro_translation.listener.datagrid.language:
        class: 'Oro\Bundle\TranslationBundle\EventListener\Datagrid\LanguageListener'
        arguments:
            - '@oro_translation.helper.language'
            - '@oro_entity.doctrine_helper'
            - '@oro_datagrid.grid_configuration.helper'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.after.oro-translation-language-grid, method: onResultAfter }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.oro-translation-language-grid, method: onBuildBefore }

    oro_translation.repository.language:
        class: 'Oro\Bundle\TranslationBundle\Entity\Repository\LanguageRepository'
        parent: oro_entity.abstract_repository
        arguments:
            - '%oro_translation.entity.language.class%'

    oro_translation.provider.translation_context:
        class: 'Oro\Bundle\TranslationBundle\Provider\TranslationContextProvider'

    oro_translation.extension.translation_context_resolver:
        class: 'Oro\Bundle\TranslationBundle\Extension\TranslationContextResolver'
        arguments:
            - '@translator'
        tags:
            - { name: oro_translation.extension.translation_context_resolver, priority: 100 }

    oro_translation.provider.language:
        class: 'Oro\Bundle\TranslationBundle\Provider\LanguageProvider'
        arguments:
            - '@oro_translation.repository.language'
            - '@oro_locale.settings'

    oro_translation.helper.language:
        class: 'Oro\Bundle\TranslationBundle\Helper\LanguageHelper'
        arguments:
            - '@oro_translation.statistic_provider'
            - '@oro_translation.packages_provider'
            - '@oro_translation.oro_translation_adapter'
            - '@oro_translation.service_provider'
            - '@oro_config.global'

    oro_translation.manager.translation:
        class: 'Oro\Bundle\TranslationBundle\Manager\TranslationManager'
        arguments:
            - '@doctrine'
            - '@oro_translation.database_translation.metadata.cache'

    oro_translation.filter.language:
        class: 'Oro\Bundle\TranslationBundle\Filter\LanguageFilter'
        parent: oro_filter.entity_filter
        tags:
            - { name: oro_filter.extension.orm_filter.filter, type: language, datasource: orm }
