Skip to content

Gradle plugin for automating the download process of localization files.

License

Notifications You must be signed in to change notification settings

beatlabs/gradle-localization-plugin

Repository files navigation

gradle-localization-plugin

Continuous Integration

Gradle plugin for automation regarding string downloading in Android apps. The plugin in its current state has been integrated with Transifex and uses Transifex API v2.

Instructions

Apply the plugin

Using plugins DSL

plugins {
  id "co.thebeat.localization" version "<version>"
}

Using legacy plugin application

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.co.thebeat.localization:localization-plugin:<version>"
  }
}

apply plugin: "co.thebeat.localization"

Configuring the plugin

Add this configuration in your app build.gradle file (does not need to be inside another closure)

groovy:

transifexLocalization {
    apiToken = 'your-api-key'
    resourceSlug = 'your-resource-path-here'
    projectSlug = 'your-project-name-here'
    localesMap = [:]
    // example localization matchings
    localesMap['main/res/values'] = 'en'
    localesMap['greece/res/values'] = 'el_GR'
    localesMap['colombia/res/values'] = 'es_CO'
    localesMap['chile/res/values'] = 'es_CL'
    srcDir = "${projectDir}/src"
}

gradle kotlin dsl:

configure<co.thebeat.localization.extensions.TransifexLocalizationExtension> {
    apiToken = "your-api-key"
    resourceSlug = "your-resource-path-here"
    projectSlug = "your-project-name-here"
    localesMap = HashMap<String, String>().apply {
        // example localization matchings
        this["main/res/values"] = "en"
        this["greece/res/values"] = "el_GR"
        this["colombia/res/values"] = "es_CO"
        this["chile/res/values"] = "es_CL"
    }
    srcDir = "${projectDir}/src"
}
  • Execute ./gradlew fetchLocalization

Contributing

Please consult the Contribution guidelines.