{"id":13806743,"url":"https://github.com/syeopite/lens","last_synced_at":"2025-04-30T23:01:29.253Z","repository":{"id":196814229,"uuid":"376140967","full_name":"syeopite/lens","owner":"syeopite","description":"A multiformat internationalization (i18n) shard for Crystal.","archived":false,"fork":false,"pushed_at":"2021-10-15T21:29:50.000Z","size":1549,"stargazers_count":16,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T20:43:13.979Z","etag":null,"topics":["crystal","gettext","hacktoberfest","i18n","internationalization","l10n","l18n","language","locale","localization","translation"],"latest_commit_sha":null,"homepage":"","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/syeopite.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.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":"2021-06-11T20:59:00.000Z","updated_at":"2021-12-27T01:21:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b844c6a-41f4-4cc8-a608-9fade309b48b","html_url":"https://github.com/syeopite/lens","commit_stats":null,"previous_names":["syeopite/lens"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syeopite%2Flens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syeopite%2Flens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syeopite%2Flens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syeopite%2Flens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syeopite","download_url":"https://codeload.github.com/syeopite/lens/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251795409,"owners_count":21645022,"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","gettext","hacktoberfest","i18n","internationalization","l10n","l18n","language","locale","localization","translation"],"created_at":"2024-08-04T01:01:15.533Z","updated_at":"2025-04-30T23:01:29.172Z","avatar_url":"https://github.com/syeopite.png","language":"Crystal","funding_links":[],"categories":["Internationalization"],"sub_categories":[],"readme":"# Lens\n[![GitHub release](https://img.shields.io/github/release/syeopite/lens.svg)](https://github.com/syeopite/lens/releases) [![Lens CI](https://github.com/syeopite/lens/actions/workflows/ci.yml/badge.svg)](https://github.com/syeopite/lens/actions/workflows/ci.yml) [![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://syeopite.github.io/lens/)\n\nA multi-format internationalization (i18n) shard for Crystal.\n\nLens is designed to be fast, versatile and simple to use! Supports the likes of Gettext, Ruby YAML and more.\n\n\n## Why use Lens?\nLens was conceived due to various problems within crystal's internationalization ecosystem. As such, Lens aspires to overcome those issues. With lens:\n\n* Support of **multiple** different formats\n* **Constant** development of new features\n* And soon, **actual full** number and time localization through CLDR\n\nIn short, Lens is packed full of features and designed for internationalization.\n\n**Note: Documentation below is for Master. [For the stable release version, please see v0.1.0.](https://syeopite.github.io/lens/getting-started)**\n\n\n## Getting started \n\nLens supports numerous different formats:\n\n| Format | Backend|  Documentation |\n|:--------:|:--------:|:----------------:|\n| GNU Gettext PO | `Gettext::POBackend` | [Here](https://syeopite.github.io/lens/formats/gnu-gettext)\n| GNU Gettext MO | `Gettext::MOBackend` | [Here](https://syeopite.github.io/lens/formats/gnu-gettext)\n| Ruby YAML | `RubyI18n::Yaml` | [Here](https://syeopite.github.io/lens/formats/ruby-yaml)\n\n\nTo get started, simply initialize a backend: \n```crystal\nbackend = Gettext::MOBackend.new(\"locales\")\n```\n\nAnd begin translating!\n```crystal\ncatalogue = backend.create[\"en_US\"]\n\n# Basic\ncatalogue.gettext(\"A message\")     # =\u003e \"Translated message\"\n# Plurals\ncatalogue.ngettext(\"I have %d apple\", \"I have %d apples\", 1) # =\u003e \"Translated I have %d apples\"\n# Context\ncatalogue.pgettext(\"CopyPasteMenu\", \"copy\")          # =\u003e \"Translated copy\"\n# Context w/ Plurals\ncatalogue.npgettext(\"CopyPasteMenu\", \"Export %d file\", \"Export %d files\", 1) # =\u003e \"Translated message with plural-form 0\"\n```\n\nNote that each backend has a slightly different API.\n\n[See Getting Started for more information](https://syeopite.github.io/lens/getting-started)\n\n\n## Installation\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     lens:\n       github: syeopite/lens\n       version: ~\u003e 0.1.0\n   ```\n\n2. Run `shards install`\n\n## Documentation\n[Reference](https://syeopite.github.io/lens/)\n\n[Library API](https://syeopite.github.io/lens/api/)\n\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/syeopite/lens/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## Contributors\n\n- [syeopite](https://github.com/syeopite) - creator and maintainer\n\n## Inspirations\n* [omarroth/gettext.cr](https://github.com/omarroth/gettext.cr)\n* [TechMagister/i18n.cr](https://github.com/TechMagister/i18n.cr)\n* [crystal-i18n/i18n](https://github.com/crystal-i18n/i18n)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyeopite%2Flens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyeopite%2Flens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyeopite%2Flens/lists"}