{"id":13514942,"url":"https://github.com/wout/rosetta","last_synced_at":"2025-05-07T01:41:03.829Z","repository":{"id":136331222,"uuid":"394369682","full_name":"wout/rosetta","owner":"wout","description":"A blazing fast internationalization (i18n) library for Crystal with compile-time key lookup.","archived":false,"fork":false,"pushed_at":"2024-01-16T10:17:40.000Z","size":2530,"stargazers_count":42,"open_issues_count":5,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T05:02:47.813Z","etag":null,"topics":["crystal","crystal-lang","i18n","internationalization","kemal","l10n","language","locale","localization","luckyframework","translation"],"latest_commit_sha":null,"homepage":"https://wout.github.io/rosetta/latest","language":"Crystal","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/wout.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["wout"]}},"created_at":"2021-08-09T16:47:26.000Z","updated_at":"2025-03-20T02:10:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0c8b652-d68a-47b0-9faf-0af7742e90fb","html_url":"https://github.com/wout/rosetta","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wout%2Frosetta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wout%2Frosetta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wout%2Frosetta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wout%2Frosetta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wout","download_url":"https://codeload.github.com/wout/rosetta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252797809,"owners_count":21805776,"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":["crystal","crystal-lang","i18n","internationalization","kemal","l10n","language","locale","localization","luckyframework","translation"],"created_at":"2024-08-01T05:01:04.196Z","updated_at":"2025-05-07T01:41:03.810Z","avatar_url":"https://github.com/wout.png","language":"Crystal","funding_links":["https://github.com/sponsors/wout"],"categories":["Crystal","Internationalization"],"sub_categories":[],"readme":"# Rosetta\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://wout.github.io/rosetta/v0.9.0/assets/rosetta-logo-accent.png\"\n       width=\"256\"\n       alt=\"Rosetta logo\"\u003e\n\u003c/p\u003e\n\nA blazing fast internationalization (i18n) library for Crystal with compile-time\nkey lookup. You'll never have a `missing translation` in your app, ever again.\n\n![GitHub](https://img.shields.io/github/license/wout/rosetta)\n![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/wout/rosetta)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wout/rosetta/ci.yml?branch=main)\n\n## Why use Rosetta?\n\n### You'll never have a missing translation\n\nRosetta is different from other internationalization libraries because it\nhandles key lookup at compile-time rather than runtime. The significant\nadvantage is that you'll be able to find missing translations - or typos in\nyour locale keys - during development rather than after you've deployed your\napp. This is also true for translation keys in all additional locales.\n\n### You'll never have a missing interpolation\n\nIn Rosetta, interpolation keys are arguments to the translation method. So if\nyou're missing an argument, the compiler will complain. The parser will also\ncompare interpolation keys in additional locales to the ones found in the\ndefault locale, and complain if some are missing.\n\n### Rosetta is more than 12x faster than similar libraries\n\nBenchmarking against other libraries which also use YAML or JSON backends,\nRosetta is 12x to 700x faster than any other one.\n\nFor simple translations:\n\n```\ncrimson-knight/i18n.cr translation 303.57k (  3.29µs) (± 4.62%)  801B/op  702.21× slower\n     crystal-i18n/i18n translation  18.07M ( 55.35ns) (± 7.28%)  48.0B/op  12.39× slower\n         syeopite/lens translation   5.09M (196.47ns) (± 4.60%)   176B/op  43.98× slower\n          wout/rosetta translation 223.86M (  4.47ns) (± 2.20%)   0.0B/op        fastest\n```\n\nFor translations with interpolations:\n\n```\ncrimson-knight/i18n.cr interpolation 318.12k (  3.14µs) (± 0.85%)    801B/op  108.51× slower\n     crystal-i18n/i18n interpolation  65.55k ( 15.26µs) (± 1.01%)  28.2kB/op  664.37× slower\n         syeopite/lens interpolation   2.04M (490.17ns) (± 1.35%)    565B/op   21.35× slower\n          wout/rosetta interpolation  43.55M ( 22.96ns) (± 4.81%)   80.0B/op         fastest\n```\n\nRosetta is that much faster because a lot of the hard work happens at\ncompile-time. And because the majority of the data is stored on the [stack\nrather than the\nheap](https://stackoverflow.com/questions/79923/what-and-where-are-the-stack-and-heap),\nout of the scope of garbage collector.\n\nRead more on [the official docs page](https://wout.github.io/rosetta/latest).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n```yaml\ndependencies:\n  rosetta:\n    github: wout/rosetta\n```\n\n2. Run `shards install`\n\n3. Run `bin/rosetta --init`\n\n4. Require the generated config file:\n\n```cr\n# src/app_name.cr\nrequire \"../config/rosetta\"\n```\n\n5. Include the `Rosetta::Translatable` mixin:\n\n```cr\n# src/pages/main_layout.cr\ninclude Rosetta::Translatable\n```\n\n6. Localize your app\n\n```cr\nRosetta.locale = :es\n\nclass Hello::ShowPage \u003c MainLayout\n  def content\n    h1 r(\"welcome_message\").t(name: \"Brian\") # =\u003e \"¡Hola Brian!\"\n  end\nend\n```\n\nRead more on [the official docs page](https://wout.github.io/rosetta/latest).\n\n## Development\n\nMake sure you have [Guardian.cr](https://github.com/f/guardian) installed. Then\nrun:\n\n```bash\n$ guardian\n```\n\nThis will automatically:\n\n- run ameba for src and spec files\n- run the relevant spec for any file in src\n- run spec file whenever they are saved\n- install shards whenever you save shard.yml\n\n## Documentation\n\n- [Reference](https://wout.github.io/rosetta/latest)\n- [API Docs](https://wout.github.io/rosetta/api/main)\n\n## Contributing\n\n### To the lib\n\n1. Fork it (\u003chttps://github.com/wout/rosetta/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n### To the docs\n\nCheck out the `docs` branch and run the following command to launch the docs locally:\n\n```\ndocker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material\n```\n\n## Contributors\n\n- [wout](https://github.com/wout) - creator and maintainer\n\n## Acknowledgements\n\nThis shard pulls inspiration from the following projects:\n\n- [crimson-knight/i18n.cr](https://github.com/crimson-knight/i18n.cr)\n- [crystal-i18n/i18n](https://github.com/crystal-i18n/i18n)\n- [syeopite/lens](https://github.com/syeopite/lens)\n- [Rails](https://github.com/rails/rails)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwout%2Frosetta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwout%2Frosetta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwout%2Frosetta/lists"}