{"id":16101487,"url":"https://github.com/mendhak/gradle-crowdin-plugin","last_synced_at":"2025-10-19T20:04:38.193Z","repository":{"id":31420266,"uuid":"34983684","full_name":"mendhak/gradle-crowdin-plugin","owner":"mendhak","description":"Build task plugin for downloading and uploading translations from Crowdin.com","archived":false,"fork":false,"pushed_at":"2020-08-23T10:42:51.000Z","size":95,"stargazers_count":10,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T08:17:21.186Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mendhak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-03T11:29:29.000Z","updated_at":"2023-09-08T16:57:17.000Z","dependencies_parsed_at":"2022-09-05T19:00:24.036Z","dependency_job_id":null,"html_url":"https://github.com/mendhak/gradle-crowdin-plugin","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fgradle-crowdin-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fgradle-crowdin-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fgradle-crowdin-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendhak%2Fgradle-crowdin-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mendhak","download_url":"https://codeload.github.com/mendhak/gradle-crowdin-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910814,"owners_count":20367545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T18:50:04.113Z","updated_at":"2025-10-19T20:04:38.072Z","avatar_url":"https://github.com/mendhak.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"Gradle Crowdin Plugin\n----\n\nThis Gradle plugin adds tasks to upload and download translation files from crowdin.com\n\n`crowdinDownload` downloads the latest translations and `crowdinUpload` uploads a source file. \n\nUses API v1.\n\n\n## Usage\n\nAdd this to your build.gradle:\n\n    plugins {\n      id \"com.mendhak.gradlecrowdin\" version \"0.1.1\"\n    }\n\nFor pre-Gradle-2.1, follow the [instructions here](https://plugins.gradle.org/plugin/com.mendhak.gradlecrowdin)\n\n## Download task\n\nFor download, the plugin invokes an export of your project's translations and then downloads the translations in a zip file. \nIt then unzips and copies to the given destination.\n\n    crowdinDownload{\n        apiKey = \"31727f222f203349979cf710a471b767\"\n        destination = \"$projectDir/src/main/res\"\n        projectId = 'my-test-project'\n    \n        //Optional\n        //Android projects\n        renameMapping  = [\n            from:  '^(.*)/(.*)$',\n            to:  /values-\\1\\/\\2/\n        ]\n        //Optional\n        excludePattern = '**/*.txt'\n    }\n\nIn some cases you may want to modify the structure as it's copied over.  \nFor example, Android projects would use `values-es` instead of `es`.  You can use the `renameMapping` option to do this.\n \nYou may also want to exclude certain files, you can do this using `excludePattern`.\n\n## Android download task\n\nCrowdin gives `ru` files as well as `pt-BR` files.  You can get them both with two tasks.\n\n      task crowdin1(group:\"crowdin\", type:com.mendhak.gradlecrowdin.DownloadTranslationsTask){\n    \n                apiKey = CROWDIN_API_KEY\n                destination = \"$projectDir/src/main/res\"\n                projectId = 'gpslogger-for-android'\n    \n                //Android projects\n                renameMapping = [\n                        from: '^([^-]*)/strings.xml$',\n                        to  : /values-\\1\\/strings.xml/\n                ]\n    \n                excludePattern = '**/*.txt'\n        }\n    \n        task crowdin2(group:\"crowdin\", type:com.mendhak.gradlecrowdin.DownloadTranslationsTask, dependsOn:\"crowdin1\"){\n    \n            apiKey = CROWDIN_API_KEY\n            destination = \"$projectDir/src/main/res\"\n            projectId = 'gpslogger-for-android'\n    \n            //Android projects\n            renameMapping = [\n                    from: '^([^-]*)-([^-]*)/strings.xml$',\n                    to  : /values-\\1-r\\2\\/strings.xml/\n            ]\n    \n            excludePattern = '**/*.txt'\n        }\n\nAnd then call it like so\n\n    task getallTranslations(group:\"crowdin\", dependsOn:\"crowdin2\")  {    }\n\nAs an alternative you can go to the file settings on crowdin and set the resulting file name to something similar to `/app/src/main/res/values-%android_code%/strings.xml`. Crowdin will then automatically generate the appropriate file structure inside the downloaded zip file. In the example file name you would have to also adjust the destination to `\"$projectDir\"`.\n\n## Upload task\n\nPoint this at your source file, such as `values/strings.xml` and the task will update it on crowdin. \n\n    crowdinUpload {\n        apiKey = \"31727f222f203349979cf710a471b767\"\n        projectId = 'my-test-project'\n        files = [\n            [ name: 'strings.xml', source: 'app/src/main/res/values/strings.xml' ]\n        ]\n    }\n\nNote that the file must exist on crowdin, this simply acts as an updater. New files are not created.\nThe files attribute expects a list of files where the name entry referrs to the file name used on crowdin and the source entry to the corresponding file in your project.\nThis also allows you to batch upload strings.xml files from separate modules.\n\n## Identification\n\nEither use the combination of project identifier(**projectId**) and project key(**apiKey**) or combination of project identifier(**projectId**), username(**username**), and account key(**accountKey**) to authorize yourself.\nIf they are all present in the configuration file, the second option is prioritized.\n\n    crowdinDownload {\n        \n        projectId = PROJECT_ID\n        \n        //First option\n        apiKey = CROWDIN_API_KEY\n        \n        //Second option, prioritized\n        username = USERNAME\n        accountKey = ACCOUNT_KEY\n        \n        //...\n    }\n\n## Branches\n\nYou can also use the version management features of crowdin.\nThis allows you to upload your files separately for each of your release and feature branches. For more details visit the [official documentation](https://support.crowdin.com/versions-management/).\n\nThe following snippet gets the currently checked out branch automatically\n\n    buildscript {\n        repositories {\n            jcenter()\n        }\n        dependencies {\n            classpath 'org.ajoberstar:grgit:1.9.0'\n        }\n    }\n\n    ext {\n        git = org.ajoberstar.grgit.Grgit.open()\n        gitBranchName = git.branch.getCurrent().name\n    }\n\nThe branch name needs to be set for the crowdinDownload and crowdinUpload tasks.\n\n    crowdinDownload {\n        ...\n        branch = gitBranchName\n        ...\n    }\n\n    crowdinUpload {\n        ...\n        branch = gitBranchName\n        ...\n    }\n\nIf the branch does not exist yet on crowdin it will be created automatically.\nKeep in mind that the characters \\ / : * ? \" \u003c \u003e | are not allowed in crowdin branch names and will be replaced with underscores by this crowdin plugin.\nSince a branch on crowdin is basically a special folder all translation files will be copied to the newly created branch.\nTherefore if you have set a title or the 'resulting file' field on crowdin and you want to keep them also for your newly created branches you need to specify the title and/or translation fields as well.\n\n    crowdinUpload {\n        ...\n        files = [\n            [\n                    title      : 'App',  // Artifact name shown to the translators (optional)\n                    name       : 'strings.xml',  // File name used on crowdin\n                    source     : 'app/src/main/res/values/strings.xml', // File that should be translated\n                    translation: 'app/src/main/res/values-%android_code%/strings.xml' // Path to store the translation (optional)\n            ]\n        ]\n        ...\n    }\n\n## Screenshot\n \nIn IDEA, the task should appear under the category crowdin as shown here\n\n![idea](screenshot.png)\n\n## Building\n\nTo build, run the `uploadArchives` task under upload.  This doesn't actually upload it anywhere, it just copies it to the 'repo' folder.\n \nYou can then reference it in another project locally, modify the gradle file to look like so:\n \n    buildscript {\n        repositories {\n        mavenCentral()\n                maven {\n                    url uri('/home/mendhak/Code/gradle-crowdin-plugin/plugin/repo')\n                }\n        }\n        dependencies {\n            classpath 'com.mendhak.gradlecrowdin:crowdin-plugin:0.1.1'\n        }\n    }\n    \n    apply plugin: 'com.mendhak.gradlecrowdin'\n\nI then publish to Maven using the `./gradlew bintrayUpload` task, and to the Gradle using `./gradlew publishPlugins` \n\n### 2020 Note\n\nThis is running on an old version of Gradle.  I tried upgrading and nothing would build or run; the errors were cryptic and the stack traces were useless.  I had to stick to OpenJDK 1.8, Gradle 2.6.  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmendhak%2Fgradle-crowdin-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmendhak%2Fgradle-crowdin-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmendhak%2Fgradle-crowdin-plugin/lists"}