{"id":16870586,"url":"https://github.com/koral--/android-gradle-localization-plugin","last_synced_at":"2025-03-17T06:31:19.883Z","repository":{"id":18045143,"uuid":"21092421","full_name":"koral--/android-gradle-localization-plugin","owner":"koral--","description":"Gradle plugin for generating localized string resources","archived":false,"fork":false,"pushed_at":"2023-11-16T10:03:52.000Z","size":1067,"stargazers_count":109,"open_issues_count":8,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-14T15:04:47.148Z","etag":null,"topics":["android","csv","gradle","hacktoberfest","i18n","internationalization","l10n","plugin","xls","xlsx","xml"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koral--.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-06-22T11:50:25.000Z","updated_at":"2024-02-23T13:28:01.000Z","dependencies_parsed_at":"2023-11-16T11:24:10.570Z","dependency_job_id":"a046cbcb-ff27-4339-bf83-239ab92d7bdd","html_url":"https://github.com/koral--/android-gradle-localization-plugin","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fandroid-gradle-localization-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fandroid-gradle-localization-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fandroid-gradle-localization-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fandroid-gradle-localization-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koral--","download_url":"https://codeload.github.com/koral--/android-gradle-localization-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847060,"owners_count":20357317,"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":["android","csv","gradle","hacktoberfest","i18n","internationalization","l10n","plugin","xls","xlsx","xml"],"created_at":"2024-10-13T15:04:49.257Z","updated_at":"2025-03-17T06:31:18.694Z","avatar_url":"https://github.com/koral--.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"android-gradle-localization-plugin\n==================================\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/pl.droidsonroids.gradle.localization/android-gradle-localization-plugin/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/pl.droidsonroids.gradle.localization/android-gradle-localization-plugin)[ ![Bintray](https://api.bintray.com/packages/koral/maven/android-gradle-localization-plugin/images/download.svg) ](https://bintray.com/koral/maven/android-gradle-localization-plugin/_latestVersion) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-android--gradle--localization--plugin-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/902)  [![Build Status](https://travis-ci.org/koral--/android-gradle-localization-plugin.svg?branch=master)](https://travis-ci.org/koral--/android-gradle-localization-plugin) [![codecov](https://codecov.io/gh/koral--/android-gradle-localization-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/koral--/android-gradle-localization-plugin)\n\nGradle plugin for generating localized string resources\n\n## Overview\nThis plugin generates Android string resource XML files from CSV or XLS(X) file.\nGeneration has to be invoked as additional gradle task. Java 1.8 is required.\n \n## Supported features\n * string arrays - see [Arrays](https://github.com/koral--/android-gradle-localization-plugin/wiki/Arrays)\n * plurals - see [Plurals](https://github.com/koral--/android-gradle-localization-plugin/wiki/Plurals)\n * non-translatable resources - `translatable` XML attribute\n * auto-escaping double quotes, apostrophes and newlines\n * auto-quoting leading and trailing spaces\n * syntax validation - duplicated, empty, invalid names detection\n * comments\n * formatted strings - `formatted` XML attribute\n * default locale specification - `tools:locale`\n * evaluate cell formulas\n  \n## Applying plugin\n### Gradle 2.1+\nIn whichever `build.gradle` file.\n```groovy\nplugins {\n  id 'pl.droidsonroids.localization' version '1.0.19'\n}\n```\nNote: exact version number must be specified, `+` cannot be used as wildcard.\n\n### All versions of Gradle\n1. Add dependency to the __top-level__ `build.gradle` file.\n\n ```groovy\n  buildscript {\n     repositories {\n         mavenCentral()\n         jcenter()\n     }\n     dependencies {\n         classpath 'com.android.tools.build:gradle:3.5.3'\n         classpath 'pl.droidsonroids.gradle.localization:android-gradle-localization-plugin:1.0.19'\n     }\n }\n ```\n Note: `mavenCentral()` and/or `jcenter()` repository can be specified, `+` can be used as wildcard in version number.\n \n2. Apply plugin and add configuration to `build.gradle` of the application, eg:\n ```groovy\n apply plugin: 'pl.droidsonroids.localization'\n ```\n \n## Usage\nInvoke `localization` gradle task. Task may be invoked from commandline or from Android Studio GUI.\n * from commandline: `./gradlew localization` (or `gradlew.bat localization` on Windows)\n * from GUI: menu `View-\u003eTool Windows-\u003eGradle` and double click `localization`\u003cbr\u003e\n \n Non existent folders will be created. __WARNING__ existing XML files will be overwritten.\n\n## Example\nThe following CSV file:\n```csv\nname,default    ,pl       ,comment   ,translatable\nfile,File       ,\"Plik\"   ,file label,\napp ,Application,,,false\n```\nwill produce 2 XML files:\n* `values/strings.xml`:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cresources\u003e\n  \u003cstring name=\"file\"\u003eFile\u003c/string\u003e\u003c!-- file label --\u003e\n  \u003cstring name=\"app\" translatable=\"false\"\u003eApplication\u003c/string\u003e\n\u003c/resources\u003e\n```\n* `values-pl/strings.xml`:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cresources\u003e\n  \u003cstring name=\"file\"\u003ePlik\u003c/string\u003e\u003c!-- file label --\u003e\n\u003c/resources\u003e\n```\n\n## Configuration\nAdd `localization` extension in `build.gradle` of particular module.\n ```groovy\n localization {\n         csvFile=file('translations.csv')\n         OR\n         csvFileURI='https://docs.google.com/spreadsheets/d/\u003ckey\u003e/export?format=csv'\n         OR\n         csvGenerationCommand='/usr/bin/xlsx2csv translation.xlsx'\n         OR\n         xlsFile=file('translations.xlsx')\n         OR\n         xlsFileURI='https://docs.google.com/spreadsheets/d/\u003ckey\u003e/export?format=xlsx'\n}\n ```\n* `csvFileURI` and `xlsFileURI` can be any valid URI, not necessarily Google Docs' one\n* `xlsFile` and `xlsFileURI` accepts both XLSX and XLS files. If filename ends with `xls` file will\n    be treated as XLS, XLSX otherwise\n\nSources,  __exactly one of them__ must be specified:\n* `csvFile`, `xlsFile` - CSV/XLS(X) file, Gradle's `file()` can be used to retrieve files by path relative to module location or absolute\n* `csvFileURI`, `xlsFileURI` - CSV/XLS(X) file URI\n* `csvGenerationCommand` - shell command which writes CSV as text to standard output.\nCommand string should be specified like for [Runtime#exec()](http://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#exec-java.lang.String-).\nStandard error of the command is redirected to the standard error of the process executing Gradle,\nso it could be seen in the Gradle console.\n\n#### Spreadsheet format:\n* `defaultColumnName` - default=`'default'`, name of the column which corresponds to default localization\n(`values` folder)\n* `nameColumnIndex` - default=unset (`nameColumnName` is taken into account), index of the column containing key names (source for the `name` XML attribute)\n* `nameColumnName` - default=`'name'` (if `nameColumnIndex` is not present), name of the column containing key names (source for the `name` XML attribute)\n* `translatableColumnName` - default=`'translatable'`, name of the column containing translatable flags\n(source for the `translatable` XML attribute)\n* `commentColumnName` - default=`'comment'`, name of the column containing comments\n* `formattedColumnName` - default=`'formatted'`, name of the column formatted flags (source for the `formatted` XML attribute)\n\nIf both `nameColumnIndex` and `nameColumnName` are specified exception is thrown.\n\nThe following options turn off some character escaping and substitutions, can be useful if you have \nsomething already escaped in source:\n* `escapeApostrophes` - default=`true`, if set to false apostrophes (`'`) won't be escaped\n* `escapeQuotes` - default=`true`, if set to false double quotes (`\"`)  won't be escaped\n* `escapeNewLines` - default=`true`, if set to false newline characters won't be escaped\n* `convertTripleDotsToHorizontalEllipsis` - default=`true`, if set to false triple dots (`...`) won't be converted to ellipsis entity `\u0026#8230;`\n* `escapeSlashes` - default=`true`, if set to false slashes (`\\`) won't be escaped\n* `normalizationForm` - default=[Normalizer.Form.NFC](http://docs.oracle.com/javase/8/docs/api/java/text/Normalizer.Form.html#NFC) if set to `null` Unicode normalization won't be performed, see [javadoc of Normalizer](http://docs.oracle.com/javase/8/docs/api/java/text/Normalizer.Form.html#NFC)\nfor more details\n\n#### (X)HTML tags escaping\n* `tagEscapingStrategy` - default=`IF_TAGS_ABSENT`, defines X(H)TML tag brackets (\u0026lt; and \u0026gt;) escaping strategy\npossible values:\n * `ALWAYS` - brackets are always escaped. E.g. \"\u0026lt;\" in source becomes \"\u0026amp;lt;\" in output XML\n * `NEVER` - brackets are never escaped. E.g. \"\u0026lt;\" in source is passed without change to output XML\n * `IF_TAGS_ABSENT` - Brackets aren't escaped if text contains tags or CDATA section. E.g.\n   \u0026lt;b\u0026gt;bold\u0026lt;/b\u0026gt; will be passed without change, but \"if x\u0026lt;4 then…\" becomes \"if x\u0026amp;lt;4 then…\".\n * `tagEscapingStrategyColumnName` - default=unset (no column), name of the column containing non-default tag escaping strategy, if cell is non-empty then strategy \n defined there is used instead of global one\n  \n#### CSV format:\n* `csvStrategy` - default=`null` (library default strategy, equivalent of\n[CSVStrategy.DEFAULT_STRATEGY](https://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/internal/csv/CSVStrategy.html#DEFAULT_STRATEGY))\n - see [CSVStrategy javadoc](https://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/internal/csv/CSVStrategy.html),\n and [sources](http://grepcode.com/file/repo1.maven.org/maven2/org.apache.solr/solr-core/4.8.0/org/apache/solr/internal/csv/CSVStrategy.java#CSVStrategy)\n since documentation is quite incomplete\n\n#### XLS(X) format:\n* `sheetName` - default=`\u003cname of the first sheet\u003e`, name of the sheet to be processed, only one can be specified, \nignored if `useAllSheets` is set to true\n* `useAllSheets` - default=`false`, if set to true all sheets are processed and `sheetName` is ignored\n* `evaluateFormulas` - default=`false`, if set to true evaluates formulas in cells\n\n#### Advanced options:\n* `ignorableColumns` - default=`[]`, columns from that list will be ignored during parsing. List should\ncontain column names e.g. `['Section', 'Notes']`. Columns containing only empty cells are always ignored.\n* `allowNonTranslatableTranslation` - default=`false`, if set to true resources marked\nnon-translatable but translated are permitted\n* `allowEmptyTranslations` - default=`false`, if set to true then empty values are permitted\n* `handleEmptyTranslationsAsDefault` - default=`false`, if set to true empty values do not result in entries in non-default languages, \ni.e. no empty XML entries for non-default languages are created. If set to `true` then `allowEmptyTranslations` is ignored for all but default language\n* `outputFileName` - default=`strings.xml`, XML file name (with extension) which should be generated as an output\n* `outputIndent` - default=`  `(two spaces), character(s) used to indent each line in output XML files\n* `skipInvalidName` - default=`false`, if set to true then rows with invalid key names will be ignored instead\nof throwing an exception\n* `skipDuplicatedName` - default=`false`, if set to true then rows with duplicated key names will be ignored instead\nof throwing an exception. First rows with given key will be taken into account.\n* `defaultLocaleQualifier` - language (eg. `es`) and optionally region (eg. `es_US`) ISO codes of default translations.\n Default=`null`(unset) which effectively means English `en`, if set then value will be placed in `tools:locale`\n XML attribute. See [Tools Attributes](http://tools.android.com/tech-docs/tools-attributes#TOC-tools:locale)\n for more information.\n\n#### Migration from versions \u003c 1.0.19\nSince version 1.0.19 completely empty (effectively empty in case of XLS(X)) rows and columns are ignored. Moreover if qualifier (usually language code) is empty exception is thrown.\nPreviously behavior in such cases was undefined.\n\n#### Migration from versions \u003c 1.0.13:\nObsolete, non-scoped `localization` plugin id is no longer supported. The only valid id is `pl.droidsonroids.localization`.\n\n#### Migration from versions \u003c 1.0.7:\nVersions older than 1.0.7 provided `escapeBoundarySpaces` option, which defaulted to `true`. Currently\nstrings are always escaped when corresponding **parsed**  cell contains leading or trailing spaces,\nbut such spaces are stripped by default CSV strategy. So effectively strings are trimmed by default.\nIf you want to include mentioned spaces in output set appropriate `csvStrategy`.\n\n## License\n\nMIT License\u003cbr\u003e\nSee [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoral--%2Fandroid-gradle-localization-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoral--%2Fandroid-gradle-localization-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoral--%2Fandroid-gradle-localization-plugin/lists"}