{"id":30770458,"url":"https://github.com/pludoni/extract_i18n","last_synced_at":"2025-09-15T02:12:17.821Z","repository":{"id":56845275,"uuid":"301687659","full_name":"pludoni/extract_i18n","owner":"pludoni","description":"Automatically extract I18n keys from Ruby, Slim files bootstrap your I18n conversion","archived":false,"fork":false,"pushed_at":"2025-05-21T15:21:12.000Z","size":227,"stargazers_count":25,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-04T23:36:50.394Z","etag":null,"topics":["i18n","pug","rails","ruby","slim"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/pludoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-10-06T10:16:51.000Z","updated_at":"2025-05-21T15:21:16.000Z","dependencies_parsed_at":"2024-01-29T14:09:23.114Z","dependency_job_id":"4ebdd1d3-cf31-42b7-94ba-03b8fc88e5ed","html_url":"https://github.com/pludoni/extract_i18n","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":"0.040000000000000036","last_synced_commit":"43ca04c63d70a8bafee8cb5504923dbde1d4fbeb"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/pludoni/extract_i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pludoni%2Fextract_i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pludoni%2Fextract_i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pludoni%2Fextract_i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pludoni%2Fextract_i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pludoni","download_url":"https://codeload.github.com/pludoni/extract_i18n/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pludoni%2Fextract_i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275194018,"owners_count":25421441,"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","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["i18n","pug","rails","ruby","slim"],"created_at":"2025-09-04T23:05:39.596Z","updated_at":"2025-09-15T02:12:17.786Z","avatar_url":"https://github.com/pludoni.png","language":"Ruby","readme":"# ExtractI18n\n\n[![Gem Version](https://badge.fury.io/rb/extract_i18n.svg)](https://badge.fury.io/rb/extract_i18n)\n\n[Read my blog post if you'd like more about the development of ExtractI18n](https://www.stefanwienert.de/blog/2020/07/26/internationalize-medium-rails-app-with-tooling/).\n\nCLI helper program to automatically extract bare text strings into Rails I18n interactively.\n\nUseful when adding i18n to a medium/large Rails app.\n\nThis Gem **supports** the following source files:\n\n- Ruby files (controllers, models etc.) via Ruby-Parser, e.g. walking all Ruby Strings\n- Slim Views (via Regexp parser by [SlimKeyfy](https://github.com/phrase/slimkeyfy) (MIT License))\n- Vue templates\n  - will scan all texts and common string-attributes such as title, alt etc. for static strings and replace with vue-i18n's $t\n  - Caveats: because of limitations of the HTML/XML parser it will slightly transform the HTML, for example, self closing tags are expanded (e.g. ``\u003cComponent /\u003e`` will become ``\u003cComponent\u003e\u003c/Component\u003e``). Also multi-line arrangements of attributes, tags etc. might produce unexpected results, so make sure to use Git and diff the result.\n- Vue Pug views\n  - Pug is very similar to slim and thus relatively well extractable via Regexp.\n- Javascript string Literals by vendoring a small **nodeJS** script in ``js/find_string_tokens.js`` (requires node16+).\n    - Vue: Literal strings in script block (via bundled nodejs file)\n    - JS/TS: Literal strings\n- ERB views\n  - by vendoring/extending https://github.com/ProGM/i18n-html_extractor (MIT License)\n\nCURRENTLY THERE IS **NO SUPPORT** FOR:\n\n- haml ( integrating https://github.com/shaiguitar/haml-i18n-extractor)\n- JS: Template-Literals\n\nBut I am open to integrating PRs for those!\n\nI strongly recommend using a Source-Code-Management (Git) and ``i18n-tasks`` for checking the key consistency.\nI've created a scanner to make that work with vue $t structures too: https://gist.github.com/zealot128/e6ec1767a40a6c3d85d7f171f4d88293\n\n## Installation\n\ninstall:\n\n    $ gem install extract_i18n\n\n## Usage\n\nDO USE A SOURCE-CODE-MANAGEMENT-SYSTEM (Git). There is no guarantee that programm will not destroy your workspace :)\n\n\n```\nextract-i18n --help\n\nextract-i18n --locale de --yaml config/locales/unsorted.de.yml app/views/user\n```\n\nIf you prefer relative keys in slim views use ``--slim-relative``, e.g. ``t('.title')`` instead of ``t('users.index.title')``.\nI prefer absolute keys, as it makes copy pasting/ moving files much safer.\n\nTo extract Vue/JS files, we usually put them in a namespace ``js.*`` and handle them with i18n-tasks as well, so to extract Vue-Components, or plain JS files:\n\n```\nextract-i18n --locale de --yaml config/locales/unsorted.de.yml -n js app/javascript/components/Foobar.vue\n```\n\nWill prefix the keys with ``js.components.foobar``. This system also switches the **interpolation format** from ``%{foo}`` to ``{foo}``, when handling Vue,JS,TS file.\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/zealot128/extract_i18n.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpludoni%2Fextract_i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpludoni%2Fextract_i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpludoni%2Fextract_i18n/lists"}