transifex-plugin

Gradle plugin that allows translations to be downloaded from transifex

License

License

Categories

Categories

Gradle Build Tools
GroupId

GroupId

com.chimerapps.gradle
ArtifactId

ArtifactId

transifex-plugin
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

transifex-plugin
Gradle plugin that allows translations to be downloaded from transifex
Project URL

Project URL

https://github.com/Chimerapps/transifex-gradle-plugin
Source Code Management

Source Code Management

https://github.com/Chimerapps/transifex-gradle-plugin

Download transifex-plugin

Dependencies

compile (7)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk7 jar 1.4.30
org.jetbrains.kotlin : kotlin-reflect jar 1.4.30
com.squareup.retrofit2 : retrofit jar 2.4.0
com.squareup.okhttp3 : okhttp jar 3.11.0
com.squareup.moshi : moshi jar 1.6.0
com.squareup.retrofit2 : converter-moshi jar 2.4.0
com.chimerapps : moshi-generator-runtime jar 0.8.5

Project Modules

There are no modules declared in this project.

transifex android gradle plugin

A simple plugin which downloads translations from transifex and saves the files to the project.

Usage:

transifex {
    apiKey 'your-api-key-here'
    projectSlug 'project-identifier-slub'
    fileName 'strings.xml'       //Default
    sourceRoot 'src/main/res'    //Default, will replace occurences of {language} with the (transformed) language
    fileType 'xml'               //Default, one of the file types supported by transifex
    
    languageRename { languageCode ->                //Default is identity transformation (return languageCode)
        return languageCode.replace('_','-r')
    }
    sourceRootProvider { languageCode ->            //Function that provides source root based on language code (this is the raw language code)
        def renamed = languageRename(languageCode)
        return sourceRoot.replace("{language}", (renamed == null) ? code : renamed)
    }
    
    fileNameProvider { languageCode ->      //Function that can generate different file names based on language code (this is the raw language code)
        return fileName
    }
    
    folderProvider { languageCode ->        //Function that provides the folder based on the (raw) language code
        def renamed = languageRename(languageCode)
        return "values-"+(renamed == null) ? code : renamed)
    }

    configuration("test") {
        apiKey 'read-only-key2'     //Uses the default fileName and sourceRoot. Not inherited
    }

    configuration("release") {
        apiKey 'read-only-key3'     //Uses the default fileName and sourceRoot. Not inherited
    }
}

You can then call the tasks from the command line:

./gradlew updateTranslations            //Runs all translations tasks
./gradlew updateDefaultTranslations     //Runs the translation task defined by the outer scope
./gradlew updateTestTranslations        //Runs the translation task defined by the 'test' configuration
./gradlew updateReleaseTranslations     //Runs the translation task defined by the 'release' configuration

NOTE: If the api key is missing from the outer scope, the 'default' configuration is not included as task

com.chimerapps.gradle

Chimerapps

Versions

Version
1.0.1