i18n
Version, currently 0.1.29 versions
github.com/crystal-i18n/i18n
An internationalization library for Crystal.
Nothing has been indexed for 0.1.2 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
i18n:
github: crystal-i18n/i18n
version: ~> 0.1.2Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.2. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Crystal I18n
Crystal I18n is an internationalization library for the Crystal programming language. It provides a unified interface allowing to leverage translations and localized contents in a Crystal project.
Features:
- Translation lookups
- Localization
- Interpolation
- Pluralization rules
- Locale fallbacks
- Flexible configuration
Documentation
Online browsable documentation is available at https://crystal-i18n.github.io/.
Installation
Simply add the following entry to your project's shard.yml:
dependencies:
i18n:
github: crystal-i18n/i18n
And run shards install afterwards.
Usage
Assuming that a config/locales relative folder exists in your project, with the following en.yml file in it:
en:
simple:
translation: "This is a simple translation"
interpolation: "Hello, %{name}!"
pluralization:
one: "One item"
other: "%{count} items"
The following setup could be performed in order to initialize I18n properly:
require "i18n"
I18n.config.loaders << I18n::Loader::YAML.new("config/locales")
I18n.config.default_locale = :en
I18n.init
Here a translation loader is configured to load the previous translation file while also configuring the default locale
(en) and initializing the I18n module.
Translations lookups can now be performed using the #translate method (or the shorter version #t) as follows:
I18n.t("simple.translation") # outputs "This is a simple translation"
I18n.t("simple.interpolation", name: "John Doe") # outputs "Hello, John Doe!"
I18n.t("simple.pluralization", count: 42) # outputs "42 items"
Please head over to the documentation for a more complete overview of the I18n
module capabilities (including the configuration options, localization features, etc).
Authors
Morgan Aubert (@ellmetha) and contributors.
Credits
Crystal I18n initially draws its inspiration from Ruby I18n and rails-i18n. Originally, pluralization and localization rules all come from rails-i18n as well.
License
MIT. See LICENSE for more details.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.2- Tagged
- Jul 25, 2026
- Commit
71386562a5ab- Indexed
- not yet
Dependents
Repository
github.com/crystal-i18n/i18n
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 24, 2026
- Synced
- Sep 23, 2026
- Versions
- 9