Skip to content

lukin0110/poeditor-gradle

Repository files navigation

poeditor-gradle

Build Status

Gradle plugin to manage translations easily within a POEditor project. The plugin enables you to include downloading and uploading of translations in your Gradle build file.

This gradle plugin depends on poeditor-java, a java client for the POEditor API.

  1. Install

Add the following 2 lines of code to your gradle.build file.

In the dependencies section:

classpath 'be.lukin.poeditor:gradle:0.3.3'

Include the plugin:

apply plugin: 'poeditor'

The plugin requires at minimum Java 7 and Gradle 2.x.

  1. Configure

Add configuration about your POEditor project to the gradle.build file. You need an api key and project id from POEditor.

Example configuration:

poeditor {
    apikey 'your api key here'
    projectId 'your project id here'
    type 'android_strings'
    tagsNew '1.0'

    terms 'App/src/main/res/values/strings.xml'
    trans 'en', 'App/src/main/res/values/strings.xml'
    trans 'nl', 'App/src/main/res/values-nl/strings.xml'
    trans 'fr', 'App/src/main/res/values-fr/strings.xml'
    
    filters 'nl', 'translated'
    filters 'fr', 'translated, automatic'
}
Parameter Description
apiKey api key to access the api, can be obtained in your Account
projectId id of the project on POEditor
type file format: po, pot, mo, xls, apple_strings, xliff, android_strings, resx, resw, properties, json
terms point to the file that contains all the terms, probably this is your default language
trans receives 2 parameters: language code & file path of a translation
filters receives 2 parameters: language code & comma separated list of filters. Check the API Reference for all available filters

Now you're all set to manage your translations.

  1. Usage

After your have created your translation project on POEditor you can can initialize your project based on your c onfiguration.

Initialize

gradle poeditorInit

This will create terms and add languages to your project.

Download translations

gradle poeditorPull

Upload translations

gradle poeditorPush
Argument Description
languages specify the languages that you want to upload, by default everything is uploaded
override force to override the translation on POEditor

Example:

gradle poeditorPush -Planguages=nl,fr -Poverride=true

Add terms

gradle poeditorPushTerms

A few example configurations can be found in the example projects folder.

License

Copyright 2015 Maarten Huijsmans

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.