Gradle GetLocalization Plugin

A Gradle plugin for managing translations through GetLocalization.

License

License

Categories

Categories

Gradle Build Tools
GroupId

GroupId

org.zooper.gradle
ArtifactId

ArtifactId

gradle-getlocalization-plugin
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

Gradle GetLocalization Plugin
A Gradle plugin for managing translations through GetLocalization.
Project URL

Project URL

https://github.com/johnuopini/gradle-getlocalization-plugin
Source Code Management

Source Code Management

https://github.com/johnuopini/gradle-getlocalization-plugin

Download gradle-getlocalization-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/org.zooper.gradle/gradle-getlocalization-plugin/ -->
<dependency>
    <groupId>org.zooper.gradle</groupId>
    <artifactId>gradle-getlocalization-plugin</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.zooper.gradle/gradle-getlocalization-plugin/
implementation 'org.zooper.gradle:gradle-getlocalization-plugin:1.2'
// https://jarcasting.com/artifacts/org.zooper.gradle/gradle-getlocalization-plugin/
implementation ("org.zooper.gradle:gradle-getlocalization-plugin:1.2")
'org.zooper.gradle:gradle-getlocalization-plugin:jar:1.2'
<dependency org="org.zooper.gradle" name="gradle-getlocalization-plugin" rev="1.2">
  <artifact name="gradle-getlocalization-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.zooper.gradle', module='gradle-getlocalization-plugin', version='1.2')
)
libraryDependencies += "org.zooper.gradle" % "gradle-getlocalization-plugin" % "1.2"
[org.zooper.gradle/gradle-getlocalization-plugin "1.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

A Gradle plugin to manage Android project translations through GetLocalization.

Basic usage

Just add the plugin to the build dependencies and provide getlocalization account info, the plugin will create a task called "downloadTranslations" to download all the translations which have more than 50% of progress (this can be changed by adding the option progress = XX to the getlocalization closure).

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.zooper.gradle:gradle-getlocalization-plugin:1.+'
    }
}

apply plugin: 'android-getlocalization'
getlocalization {
    user = "yourusername"
    password = "yourpassword"
    project = "projectname"
}

Then you can just type "gradle downloadTranslations" or add it as a dependency to your release build with:

release.dependsOn downloadTranslations

IANA Codes

Android does not use the same IANA code format that Get Localization uses and sometimes you might want to map a translation to more than one language. Basic mapping provided by the plugin is the following:

  iana_codes = [
    "bg-BG": "BG",
    "cs-CZ": "cs",
    "pt-PT": "pt",
    "pt-BR": "pt-rBR",
    "hr-HR": "hr",
    "hu-HU": "hu",
    "ja-JP": "ja",
    "no": "no,nb",
    "sk-SK": "sk",
    "tr-TR": "tr",
    "zh-TW" : "zh-rTW",
    "zh-CN" : "zh-rCN",
  ]

This means that for example "bg-BG" will be copied to "values-bg" and "no" will be copied to both "values-no" and "values-nb". You can provide your custom mappings in the configuration, for example, to download translations with progress > 10% and map Brazilian Portoguese to both Brazilian Portoguese and generic Portoguese you can do this:

getlocalization {
    user = "yourusername"
    password = "yourpassword"
    project = "projectname"
    progress = 10
    iana_codes["pt-BR"] = "pt,pt-rBR"
}

Master Files

GetLocalization allows multiple master files, in case you want to download translations referring to only one of these you can do so by specifying the master file in the getlocalization closure, so:

getlocalization {
    user = "yourusername"
    password = "yourpassword"
    project = "projectname"
    master = "mystrings.xml" 

Versions

Version
1.2
1.1
1.0