Popularity
3.8
Declining
Activity
0.0
Stable
16
2
1

Programming language: Crystal
License: MIT License
Tags: Internationalization    

Lens alternatives and similar shards

Based on the "Internationalization" category.
Alternatively, view lens alternatives based on common mentions on social networks and blogs.

  • Rosetta

    A blazing fast internationalization (i18n) library for Crystal with compile-time key lookup.

Do you think we are missing an alternative of Lens or a related project?

Add another 'Internationalization' Shard

README

Lens

GitHub release Lens CI Docs

A multi-format internationalization (i18n) shard for Crystal.

Lens is designed to be fast, versatile and simple to use! Supports the likes of Gettext, Ruby YAML and more.

Why use Lens?

Lens was conceived due to various problems within crystal's internationalization ecosystem. As such, Lens aspires to overcome those issues. With lens:

  • Support of multiple different formats
  • Constant development of new features
  • And soon, actual full number and time localization through CLDR

In short, Lens is packed full of features and designed for internationalization.

Note: Documentation below is for Master. For the stable release version, please see v0.1.0.

Getting started

Lens supports numerous different formats:

Format Backend Documentation
GNU Gettext PO Gettext::POBackend Here
GNU Gettext MO Gettext::MOBackend Here
Ruby YAML RubyI18n::Yaml Here

To get started, simply initialize a backend:

backend = Gettext::MOBackend.new("locales")

And begin translating!

catalogue = backend.create["en_US"]

# Basic
catalogue.gettext("A message")     # => "Translated message"
# Plurals
catalogue.ngettext("I have %d apple", "I have %d apples", 1) # => "Translated I have %d apples"
# Context
catalogue.pgettext("CopyPasteMenu", "copy")          # => "Translated copy"
# Context w/ Plurals
catalogue.npgettext("CopyPasteMenu", "Export %d file", "Export %d files", 1) # => "Translated message with plural-form 0"

Note that each backend has a slightly different API.

See Getting Started for more information

Installation

  1. Add the dependency to your shard.yml:
   dependencies:
     lens:
       github: syeopite/lens
       version: ~> v0.1.0
  1. Run shards install

Documentation

Reference

Library API

Contributing

  1. Fork it (https://github.com/syeopite/lens/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Inspirations