Skip to content

Gradle plugin to manage translations easily within a POEditor project.

Notifications You must be signed in to change notification settings

jansauer/gradle-poeditor-plugin

Repository files navigation

Gradle POEditor Plugin

Gradle plugin to manage translations easily within a POEditor project. The plugin enables you to upload and download terms and respectively translations via gradle tasks.

Getting Started

Add this snippet to your build script.

plugins {
  id 'de.jansauer.poeditor' version '1.0.0'
}

poeditor {
  apiKey = 'd41d8cd98f00b204e9800998ecf8427e'
  projectId = '12345'

  terms lang: 'en', file: 'messages.xmb'
  
  trans lang: 'de', file: 'build/translations_de.xtb'
  trans lang: 'it', file: 'build/translations_it.xtb'
}

Tasks

  • poeditorPush Upload terms and/or translations
  • poeditorPull Download translations

Configuration

poeditor {
  apiKey = 'd41d8cd98f00b204e9800998ecf8427e'
  projectId = '12345'

  terms lang: 'en', file: 'messages.xmb', updating: 'terms_translations'
  trans lang: 'it', file: 'build/translations_it.csv', type: 'csv', tags: ['feature1','feature2']
}
  • apiKey: Key for the authentication with the poeditor api.
    Can be found at My Account > API Access
  • projectId: Id of poeditor project terms and translations are pulled from and pushed to.
    Can also be found at My Account > API Access
  • terms: Can be used multiple times to define terms to push to poeditor.
    • updating: One of 'terms', 'terms_translations' or 'translations' (Default: 'terms')
    • file: Local file to be uploaded (List of supported formats)
    • lang: The language code (Default: 'en')
    • overwrite: Set to true if you want to overwrite translations (Default: false)
    • sync_terms: Set to true if you want to sync your terms (terms that are not found in the uploaded file will be deleted from project and the new ones added). Ignored if updating is set to 'translations' (Default: false)
  • trans: Can be used multiple times to define translations to pull from poeditor.
    • lang: The language code (Default: 'en')
    • type: File format (po, pot, mo, xls, csv, resw, resx, android_strings, apple_strings, xliff, properties, key_value_json, json, xmb, xtb) (Default: 'xtb')
    • file: Location where the downloaded translations are stored.
    • tags: Pull translations that match all of the given tags (Default: [])

Tested Gradle Versions

This plugin is automatically tested with all supported gradle versions.

  • Pre 4.10 does not work well with JDK11 plugin builds
  • 5.0 has a bug with manually added ListProperty (#7961)

Publishing Workflow

Every commit on this repository gets tested via circleci. Commits that are tagged with a semantic version are also automatically published to the gradle plugin directory as a new version.

Contributing

Pull requests are always welcome. I'm grateful for any help or inspiration.

License and Authors

Author: Jan Sauer <jan@jansauer.de> (https://jansauer.de)

Copyright 2019, Jan Sauer <jan@jansauer.de> (https://jansauer.de)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Gradle plugin to manage translations easily within a POEditor project.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages