jansauer / gradle-poeditor-plugin

Gradle plugin to manage translations easily within a POEditor project.
10 stars 5 forks source link

Add support to filter by tag #10

Open extmkv opened 5 years ago

extmkv commented 5 years ago

Currently, I'm using the gradle-poeditor-plugin in one of my android multi module project and in that project I've strings in several modules. In POEditor all strings have a specific tag, that tag is the name of the module where the string is inside. So, I was checking the POEditor API 2.0 and in the export endpoint it's possible to filter by tag.

Example of the curl request:

     -d api_token=$TOKEN \
     -d tags="library" \
     -d id=$PROJECT_ID" \
     -d language="en" \
     -d type="android_strings"

So the ideia is to add a new field to the trans called tags: Example:

trans type: 'android_strings', file: 'library/src/main/res/values/strings.xml', tags:["library"]

jansauer commented 5 years ago

Hey @extmkv; thx for input. I like the idea and the resulting possibilities. I started looking into implementing this but did not find the api parameter you mentioned. Screenshot 2019-07-02 at 18 57 51 As far as i kenn tell the v2 export endpoint does not have a tags argument 🤔 v1 seams to heave this.

extmkv commented 5 years ago

They don't have the tags in the documentation for v2 but I already have tested and works fine ;)

extmkv commented 5 years ago

@jansauer I'm adding here the full curl request:

curl -X POST https://api.poeditor.com/v2/projects/export \ -d api_token=$TOKEN \ -d tags="library" \ -d id=$ID \ -d language="en" \ -d type="android_strings"

Tested and works fine.

jzeferino commented 5 years ago

Also needed this improvement in the past would be fine to have this.

extmkv commented 5 years ago

any news @jansauer ?

c-b-h commented 5 years ago

This enhancement is a must for multi-module-projects.

Also both our mobile teams (iOS and Android) share the same set of localized strings and tagging is a way we plan to differentiate strings that are specific for each platform.

I really hope this enhancement is included soon as to not resort to fastlane or similar scripts. You would make my work a lot easier if this is included and if weren't for a fact that I have never managed to correctly build a forked gradle project I would have added it my self.🙏

c-b-h commented 5 years ago

@extmkv I just noticed that you have forked this project. Have you managed to include this enhancement in your fork?

extmkv commented 5 years ago

@c-b-h yes I've forked this project, but I don't have so much time to code this improvement. I don't have any idea if @jansauer or someone else is planning to do it or not...

extmkv commented 5 years ago

@jansauer @c-b-h any update on this?

c-b-h commented 5 years ago

@extmkv, @jansauer

I created a pull request for this change and it works.

https://github.com/jansauer/gradle-poeditor-plugin/pull/17

extmkv commented 5 years ago

Thank you so much @c-b-h !

extmkv commented 5 years ago

@c-b-h I was checking and we're not sending the tags when creating the terms. Imagine the following scenario, I add a new string into the project and when I run the task to upload the terms don't contain the tag.

Screenshot-2019-09-20-at-10-29-01.png

c-b-h commented 5 years ago

How would you, in the string.xml-file, tag an entry? I didn't know it was possible to let POEditor know that a certain XML-entry has a tag therefore I haven't implemented a way of pushing the tags either.

c-b-h commented 5 years ago

@extmkv ^^

extmkv commented 5 years ago

@c-b-h Please take a look on the following screenshot

Screenshot 2019-09-25 at 17 38 07

So, it's possible to send also tags to the terms and everytime when we push the terms they will have the specific tags.

More info:

extmkv commented 5 years ago

I've created a PR to support tags on pushing terms #18