{"id":19777505,"url":"https://github.com/ilib-js/ilib-loctool-tap-i18n","last_synced_at":"2026-03-02T20:37:24.289Z","repository":{"id":240318940,"uuid":"801261509","full_name":"iLib-js/ilib-loctool-tap-i18n","owner":"iLib-js","description":"Loctool plugin to parse Tap-I18n style yaml files","archived":false,"fork":false,"pushed_at":"2024-05-22T00:49:54.000Z","size":36,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-22T23:59:30.198Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iLib-js.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-15T22:26:34.000Z","updated_at":"2024-06-17T16:59:30.970Z","dependencies_parsed_at":"2024-06-17T16:59:29.048Z","dependency_job_id":"b41b9d66-2c3e-4d40-b58a-5322fabd0d98","html_url":"https://github.com/iLib-js/ilib-loctool-tap-i18n","commit_stats":null,"previous_names":["ilib-js/ilib-loctool-tap-i18n"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Filib-loctool-tap-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Filib-loctool-tap-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Filib-loctool-tap-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Filib-loctool-tap-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iLib-js","download_url":"https://codeload.github.com/iLib-js/ilib-loctool-tap-i18n/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241107734,"owners_count":19910975,"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-11-12T05:25:18.804Z","updated_at":"2026-03-02T20:37:19.257Z","avatar_url":"https://github.com/iLib-js.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003e :warning: **Deprecation Notice** :warning:\n\u003e This repository has been deprecated. Please use the corresponding package from the [iLib-js monorepo](https://github.com/iLib-js/ilib-mono) instead.\n\n# ilib-loctool-tap-i18n\n\nIlib loctool plugin to parse and localize tap-i18n style of YAML\nresource files.\n\n## Configuration\n\nBy default, plugin will localize source `.yml` and `.yaml` files,\ne.g. `/project/en.i18n.yml`,  and write localized files\nto a parallel file named for the locale: `/project/ru-RU.i18n.yml`.\n\nThe plugin will look for the `tap` property within the `settings`\nof your `project.json` file. The following settings are\nused within the yaml property:\n\n- `mappings`: a mapping between file matchers and an object that gives\n  info used to localize the files that match it.\n  The matchers are\n  a [micromatch-style string](https://www.npmjs.com/package/micromatch),\n  similar to the the `includes` and `excludes` section of a\n  `project.json` file. The value of that mapping is an object that\n  can contain the following properties:\n  - `template`: a path template to use to generate the path to\n    the translated output files. The template replaces strings\n    in square brackets with special values, and keeps any characters\n    intact that are not in square brackets. The default template,\n    if not specified is \"[dir[/[locale].yaml\".\n    The plugin recognizes and replaces the following strings\n    in template strings:\n    - [dir] the original directory where the matched source file\n      came from. This is given as a directory that is relative\n      to the root of the project. eg. \"foo/bar/strings.yaml\" -\u003e \"foo/bar\"\n    - [filename] the file name of the matching file.\n      eg. \"foo/bar/strings.yaml\" -\u003e \"strings.yaml\"\n    - [basename] the basename of the matching file without any extension\n      eg. \"foo/bar/strings.yaml\" -\u003e \"strings\"\n    - [extension] the extension part of the file name of the source file.\n      etc. \"foo/bar/strings.yaml\" -\u003e \"yaml\"\n    - [locale] the full BCP-47 locale specification for the target locale\n      eg. \"zh-Hans-CN\" -\u003e \"zh-Hans-CN\"\n    - [language] the language portion of the full locale\n      eg. \"zh-Hans-CN\" -\u003e \"zh\"\n    - [script] the script portion of the full locale\n      eg. \"zh-Hans-CN\" -\u003e \"Hans\"\n    - [region] the region portion of the full locale\n      eg. \"zh-Hans-CN\" -\u003e \"CN\"\n    - [localeDir] the full locale where each portion of the locale\n      is a directory in this order: [langage], [script], [region].\n      eg, \"zh-Hans-CN\" -\u003e \"zh/Hans/CN\", but \"en\" -\u003e \"en\".\n    - [localeUnder] the full BCP-47 locale specification, but using\n      underscores to separate the locale parts instead of dashes.\n      eg. \"zh-Hans-CN\" -\u003e \"zh_Hans_CN\"\n  - `commentPrefix` - a string that defines prefix for context comment for\n    translators. The prefix will be stripped when comments are extracted.\n\nExample configuration:\n\n```json\n{\n  \"settings\": {\n    \"tap\": {\n      \"mappings\": {\n        \"**/source.i18n.yml\": {\n          \"template\": \"resources/[localeDir]/source.i18n.yaml\"\n        },\n        \"src/**/en-US.i18n.yaml\": {\n          \"template\": \"[dir]/[locale].i18n.yaml\",\n          \"commentPrefix\": \"L10N:\"\n        }\n      }\n    }\n  }\n}\n```\n\nIn the above example, any file named `source.i18n.yml` will be parsed.\nThe output files are saved to the `resources` directory under a directory\nnamed for the locale.\n\nAlso files named `en-US.i18n.yaml` that are located in directory `src`\nor any of its subdirectories will be parsed using the given `commentPrefix`\nrules.\n\n## Providing context comments\n\nThe plugin automatically parses yaml comments and assigns them\nto corresponding strings as context comments.\n\nA context comment must be placed above the source string.\nIt's also possible to use multiline comments.\n\n**Same line comments are ignored!**\n\n```yaml\nheader_text: \"Header\" # this comment is ignored\n\n# Comment for article_title.\narticle_title: \"Article:\"\n\n# Comment for article_summary,\n# it includes view count and edit count values.\narticle_summary: \"Stats: {view_count} views, {edit_count} edits\"\n```\n\nComments are trimmed upon extraction, so therefore there's no\ndifference between these two example comments:\n\n```yaml\n#comment\nfirst: \"first\"\n#     comment \u003csome extra space chars here\u003e\nsecond: \"second\"\n```\n\nMultiline comments will preserve line breaks as well as spaces\non a new line (only space chars at the beginning of the\nfirst line and at the end of the last are trimmed):\n\n```yaml\n#    Multiline comment\n#    with some extra spaces in between \u003csome extra space chars here\u003e\n```\nwould be parsed as\n`Multiline comment\\n    with some extra spaces in between`\n\nComments that start with the given `commentPrefix` in the mapping\nwill be extracted, but that prefix will be stripped out first.\n\nExample when the mapping says that the commentPrefix is \"L10N:\"\n\n```yaml\n# L10N: a prefixed comment\nfoo: bar\n```\n\nThis will extract the `foo` string with the value `bar` and the comment will\nbe set to `a prefixed comment`.\n\n## License\n\nThis plugin is license under Apache2. See the [LICENSE](./LICENSE)\nfile for more details.\n\n## Release Notes\n\n### v1.1.1\n\n- fixed a problem between using loctool internal resources and ilib-tools-common\n  resources. They are almost the same, but not completely, which lead to\n  problems in producing localized versions of the tap yaml files.\n\n### v1.1.0\n\n- Added the ability to use the global locale mapping\n\n### v1.0.0\n\n- Initial version\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filib-js%2Filib-loctool-tap-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filib-js%2Filib-loctool-tap-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filib-js%2Filib-loctool-tap-i18n/lists"}