maschmann / TranslationLoaderBundle

Symfony2 bundle with database translation loader
23 stars 9 forks source link

add XML Schema definition for the bundle configuration #15

Closed xabbuh closed 10 years ago

xabbuh commented 10 years ago

This adds an XML Schema Definition file for the bundle configuration.

With this you'll be able to configure the bundle using XML like this:

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:translation-loader="https://github.com/maschmann/TranslationLoaderBundle/schema/dic"
    xsi:schemaLocation="http://symfony.com/schema/dic/services
        http://symfony.com/schema/dic/services/services-1.0.xsd
        https://github.com/maschmann/TranslationLoaderBundle/schema/dic
        https://github.com/maschmann/TranslationLoaderBundle/schema/dic/translation-loader-1.0.xsd"
>
    <translation-loader:config driver="orm" history="false">
        <translation-loader:resource locale="fr">
            <translation-loader:domain>foo</translation-loader:domain>
            <translation-loader:domain>bar</translation-loader:domain>
        </translation-loader:resource>
        <translation-loader:resource locale="de">
            <translation-loader:domain>baz</translation-loader:domain>
        </translation-loader:resource>
        <translation-loader:resource locale="en" />

        <translation-loader:database entitiy-manager="default" />
    </translation-loader:config>
</container>

which is equivalent to the following YAML config:

asm_translation_loader:
    resources:
        fr: [ foo, bar ]
        de: baz
        en: ~
    driver: orm
    history: false
    database:
        entity_manager: default

The only thing I guess where we should find a solution is which URL to use for the Namespace-URL (using https://github.com/maschmann/TranslationLoaderBundle/schema/dic/translation-loader-1.0.xsd is imho no good idea).