lukin0110 / poeditor-gradle

Gradle plugin to manage translations with POEditor
https://poeditor.com
Apache License 2.0
26 stars 7 forks source link

Possibility to add multiple configurations per project #5

Open karl-ravn opened 9 years ago

karl-ravn commented 9 years ago

When having several flavours (for android), you need to create multiple projects in order to have different project ids in poeditor. Otherwise, it seems to be uncertain which project will get downloaded.

It seems to not matter which project you run poeditors commands from, both projects will get pulled/pushed.

Workaround in build.gradle file is:

project(':TranslationA') {
    apply plugin: 'poeditor'

    poeditor {
        apikey 'xxxxxxxxxxxxxxxxxxxxxxx'
        projectId '12345'
        type 'android_strings'
        tagsNew '1.0'

        terms 'App/src/main/res/values/localization_strings.xml'
        trans 'en', 'App/src/A/res/values/localization_strings.xml'
        trans 'nl', 'App/src/A/res/values-nl/localization_strings.xml'

    }
}

project(':TranslationB') {
    apply plugin: 'poeditor'

    poeditor {
        apikey 'xxxxxxxxxxxxxxxxxxxxxxx'
        projectId '54321'
        type 'android_strings'
        tagsNew '1.0'

        terms 'App/src/main/res/values/localization_strings.xml'
        trans 'en', 'App/src/B/res/values/localization_strings.xml'

    }

}
lukin0110 commented 9 years ago

@karl-ravn Sorry for the late response. Somehow i didn't got notified by github that you opened an issue. I understand the issue. If you have 2 projects configured and you run gradle poeditorPull it will download the translations from both right?

How can we fix this? Is it possible to make the declaration of poeditor dynamic (i'm not an experience gradle plugin dev:)). For example:

poeditorProjectA {
 ...
}

poeditorProjectB {
 ... 
}

This will add the following tasks to your gradle:

gradle poeditorProjectAInit
gradle poeditorProjectAPull

gradle poeditorProjectBInit
gradle poeditorProjectBPull

Will this work for multi project configuration or do propose another way of configuration?