m2mtech / weblate-translation-provider

Weblate translation provider for Symfony Translation.
MIT License
17 stars 9 forks source link

Documentation: How to set source-language other than English #2

Closed tobias47n9e closed 2 years ago

tobias47n9e commented 2 years ago

When pushing translations to a new project using this config:

framework:
    default_locale: '%locale%'
    translator:
        providers:
            weblate:
                dsn: '%env(WEBLATE_DSN)%'
                locales: ['de', 'fr', 'it']

and in services.yaml:

parameters:
    locale: 'de'

and in my translations folder I have 3 files:

messages.de.yml
messages.fr.yml
messages.it.yml

and this command:

bin/console translation:push --domains=messages weblate

I get this result (after starting a translation project for Italian):

image

Would it be possible to document how to push e.g. "de" as the source-language? Sorry if this falls under support, rather than bug report.

m2mtech commented 2 years ago

Sorry, for the stupid answer: It works for me ;)

The bundle uses kernel.default_locale https://github.com/m2mtech/weblate-translation-provider/blob/3af95203448161f774a4d48cf0c835c779c6466c/src/Resources/config/services.php#L20-L29

and provides it to weblate when creating a component: https://github.com/m2mtech/weblate-translation-provider/blob/3af95203448161f774a4d48cf0c835c779c6466c/src/Api/ComponentApi.php#L136-L144

My settings in symfony are:

framework:
    default_locale: de
    translator:
        fallbacks:
            - de
        providers:
            weblate:
                dsn: '%env(WEBLATE_DSN)%'
                locales: [en, de]

Please try to figure out, if the bundle uses the correct default_locale or if weblate ignores the provided source language.

tobias47n9e commented 2 years ago

After some more testing I think you are right. It probably also helped that I deleted the project on weblate and recreated it. After the push the source-language was set correctly to the default_locale. Not sure what I did wrong before. Thanks for your help :smile: