Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whity/crystal-i18n
https://github.com/whity/crystal-i18n
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/whity/crystal-i18n
- Owner: whity
- License: mit
- Created: 2015-10-04T11:39:00.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-29T19:11:31.000Z (about 8 years ago)
- Last Synced: 2024-08-01T00:41:17.007Z (3 months ago)
- Language: Crystal
- Size: 563 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# i18n
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
i18n:
github: whity/crystal-i18n
```## Usage
```crystal
require "i18n/backend/yaml"# create a i18n object
i18n = I18n.from_yaml_files("[folder where the locale files are located]")# simple translation
i18n.translate("hello")# pluralization
i18n.translate("new_message", count: 2)# number format
i18n.number(123.to_s)# currency format
i18n.currency(12345.to_s)# time format
i18n.time(Time.now)# date format
i18n.date(Time.now, format: "long")
```## Contributing
1. Fork it ( https://github.com/[your-github-name]/i18n/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
- whity(https://github.com/whity) André Brás - creator, maintainer