{"id":13832050,"url":"https://github.com/polok/TaggerString","last_synced_at":"2025-07-09T15:34:41.106Z","repository":{"id":21844518,"uuid":"25167702","full_name":"polok/TaggerString","owner":"polok","description":"TaggerString is very light library which allows to build dynamic string resource in much more readable way.","archived":false,"fork":false,"pushed_at":"2015-04-03T07:14:05.000Z","size":383,"stargazers_count":240,"open_issues_count":2,"forks_count":16,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-04T10:08:29.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/polok.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":"2014-10-13T16:45:01.000Z","updated_at":"2024-03-20T08:31:40.000Z","dependencies_parsed_at":"2022-07-16T23:46:06.746Z","dependency_job_id":null,"html_url":"https://github.com/polok/TaggerString","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polok%2FTaggerString","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polok%2FTaggerString/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polok%2FTaggerString/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polok%2FTaggerString/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polok","download_url":"https://codeload.github.com/polok/TaggerString/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225565970,"owners_count":17489290,"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-08-04T10:01:49.384Z","updated_at":"2024-11-20T13:32:29.194Z","avatar_url":"https://github.com/polok.png","language":"Java","funding_links":[],"categories":["Java","Libs","Other"],"sub_categories":["\u003cA NAME=\"Tools\"\u003e\u003c/A\u003eTools"],"readme":"TaggerString\n============\n\nTaggerString is very light library which allows to build dynamic string resource in much more readable way.\n\n[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-TaggerString-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1048)\n\nI guess that every Android developer has seen or added similar piece of code in *string.xml* file:\n\n```xml\n\u003cstring name=\"user_description_string\"\u003eI am %s and I am %d years old\u003c/string\u003e`\n```\n\nSome probably discovered that above code is a little bit not readable and extended such declarations to something like this:\n```xml\n\u003cstring name=\"user_description_string\"\u003eI am $1%s and I am $2%d years old\u003c/string\u003e\n```\n\nAnd in source code:\n```java\nString userDesc = String.format(resources.getString(R.string.user_description_string), \"John Kowalski\", 27);\n```\n\nSo far so good but maybe this could be a little bit more readable ? Yes, it can be (at least in my opinion) - **TaggerString**.\n\nIn source code above example will look like :\n\n```java\n  TaggerString taggerString = TaggerString.from(getString(R.string.user_description_string));\n  taggerString.with(\"user_name\", \"John Kowalski\");\n  taggerString.with(\"user_age\", 27);\n  tvExampleOne.setText(taggerString.format());\n```\n\nAnd our string resource looks\n\n```xml\n\u003cstring name=\"example_one\"\u003eMy name is {user_name} and I am a {developer_role}\u003c/string\u003e\n```\n\nIf you want to use **bold** (TaggerStyleType.BOLD), *italic* (TaggerStyleType.ITALIC) or underscore (TaggerStyleType.UNDERLINE), please go ahead:\n\n```java\nTaggerString taggerString = TaggerString.from(getString(R.string.user_description_string));\ntaggerString.with(\"user_name\", \"John Kowalski\", TaggerStyleType.BOLD);\ntaggerString.with(\"user_age\", 27, TaggerStyleType.UNDERLINE);\ntvExampleOne.setText(taggerString.formatCustom());\n```\nPlease note that in this case method *formatCustom()* returns *Spanned* object.\n\n##### Multiple formatting (since version 1.1.0)\nIf you want to apply few tags for one string go ahead and do it:\n\n```java\ntaggerString.with(\"developer_role\", \"Android Software Developer\", TaggerStyleType.UNDERLINE, TaggerStyleType.BOLD, TaggerStyleType.ITALIC);\n```\n\nUsage\n----------\n\nIf you are using gradle please add below:\n\n```xml\ndependencies {\n    compile 'com.github.polok.taggerstring:library:1.0.0'\n}\n```\n\n####\nSince version 1.1.0 the artefactId was changed from library to taggerstring:\n\n```xml\ndependencies {\n    compile 'com.github.polok.taggerstring:taggerstring:1.1.0'\n}\n```\n\nDeveloped By\n------------\nMarcin Polak - mpolak87(at).gmail.com\n\nLicense\n----------\n\n```\nCopyright 2015 Marcin Polak\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolok%2FTaggerString","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolok%2FTaggerString","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolok%2FTaggerString/lists"}