• Stars
    star
    24
  • Rank 954,642 (Top 20 %)
  • Language
    Crystal
  • License
    MIT License
  • Created over 6 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Internationalization shard 🌍

I18n

Built with Crystal Build status API Docs Releases Awesome vladfaust.com Patrons count Gitter chat

Internationalization module for Crystal.

Supporters

Thanks to all my patrons, I can continue working on beautiful Open Source Software! πŸ™

Lauri Jutila, Alexander Maslov, Dainel Vera

You can become a patron too in exchange of prioritized support and other perks

Become Patron

Installation

Add this to your application's shard.yml:

dependencies:
  i18n:
    github: vladfaust/i18n.cr
    version: ~> 0.1.1

This shard follows Semantic Versioning 2.0.0, so see releases and change the version accordingly.

Usage

# es.yml
es:
  apples:
    one: 1 manzana
    other: "%{count} manzanas"
require "i18n"
require "i18n/backends/yaml"

I18n.backend = I18n::Backends::YAML.new.tap do |backend|
  backend.load_paths << Dir.current + "/locales"
  backend.load
end

I18n.default_locale # => "en"
I18n.locale = "es"

I18n.t("apples", count: 3) # => "3 manzanas"

You can implement your own I18n::Backend, as well as your own quantity keys rules ("one", "many" etc.). Read more in docs.

Development

Tests included! Run crystal spec while developing.

There is currently no code for localization currencies, date and time etc. If you need it, please open an issue and/or a pull request.

Contributing

  1. Fork it ( https://github.com/vladfaust/i18n.cr/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

More Repositories

1

unity-wakatime

WakaTime plugin for Unity ⏱
C#
116
star
2

crystalworld

RealWorld back-end API implementation πŸ‘
Crystal
43
star
3

migrate.cr

A database migration solution 🚜
Crystal
31
star
4

jbuilder-json_api

Jbuilder meets jsonapi.org specifications
Ruby
23
star
5

http-multiserver.cr

Mount multiple web applications 🚦
Crystal
23
star
6

http-params-serializable

The HTTP params parsing module for Crystal πŸ€“
Crystal
20
star
7

tarantool.cr

The Tarantool driver (a.k.a. connector) πŸ•·
Crystal
19
star
8

mini_redis

A light-weight low-level Redis client for Crystal ♨️
Crystal
18
star
9

validations.cr

Validations module for Crystal βœ…
Crystal
13
star
10

tele.cr

A convenient Telegram Bot framework πŸ€–
Crystal
13
star
11

callbacks.cr

Expressive callbacks module for Crystal πŸš‰
Crystal
12
star
12

background

Fast background job processing
Crystal
11
star
13

stripe.cr

🚧 WIP 🚧 Stripe API wrapper πŸ’³
Crystal
7
star
14

onyx-http-deprecated

Deprecated Onyx module
Crystal
6
star
15

cake-bake

Bake Cakefile into native Crystal code 🍞
Crystal
5
star
16

time-span-humanize

Time::Span#humanize method
Crystal
5
star
17

crack

Alternative Crystal HTTP server implementation
Crystal
5
star
18

timer.cr

A versatile timer module ⏲
Crystal
4
star
19

realworld-benchmark

RealWorld Benchmark
Crystal
3
star
20

onyx-40-loc-distributed-chat

Distributed websocket chat in 40 lines of code
JavaScript
2
star
21

time_format.cr

Time spans formatting made simple ⌚️
Crystal
2
star
22

Expense-Manager-2

Java
1
star
23

attribute_enum

Rails-like enums with ease
Ruby
1
star
24

tele-broadcast.cr

Broadcasting for Tele πŸ“’
Crystal
1
star