All Projects → ruby-i18n → I18n

ruby-i18n / I18n

Licence: mit
Internationalization (i18n) library for Ruby

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to I18n

Accent
The first developer-oriented translation tool. True asynchronous flow between translators and your team.
Stars: ✭ 721 (-16.65%)
Mutual labels:  i18n
Ordinalize full
Turns a number into an ordinal string such as first, second, third or 1st, 2nd, 3rd.
Stars: ✭ 6 (-99.31%)
Mutual labels:  i18n
Satakieli
Satakieli is a i18n library that provides identical API for ClojureScript and Clojure programmers. Localized messages can be written using ICU MessageFormat syntax.
Stars: ✭ 24 (-97.23%)
Mutual labels:  i18n
Vue I18n
🌐 Internationalization plugin for Vue.js
Stars: ✭ 6,502 (+651.68%)
Mutual labels:  i18n
Django Rosetta
Rosetta is a Django application that eases the translation process of your Django projects
Stars: ✭ 806 (-6.82%)
Mutual labels:  i18n
Translatedjs
Internationalization and localization for JavaScript and Node.js
Stars: ✭ 17 (-98.03%)
Mutual labels:  i18n
React Ssr Setup
React Starter Project with Webpack 4, Babel 7, TypeScript, CSS Modules, Server Side Rendering, i18n and some more niceties
Stars: ✭ 678 (-21.62%)
Mutual labels:  i18n
Flarum I18n Zh
Flarum 国际化语言包
Stars: ✭ 10 (-98.84%)
Mutual labels:  i18n
I18n Module
i18n for Nuxt
Stars: ✭ 808 (-6.59%)
Mutual labels:  i18n
Pimcore I18n
Pimcore - i18n Manager
Stars: ✭ 19 (-97.8%)
Mutual labels:  i18n
React I18next
Internationalization for react done right. Using the i18next i18n ecosystem.
Stars: ✭ 6,942 (+702.54%)
Mutual labels:  i18n
Frenchkiss.js
The blazing fast lightweight internationalization (i18n) module for javascript
Stars: ✭ 776 (-10.29%)
Mutual labels:  i18n
Moment.php
Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Stars: ✭ 900 (+4.05%)
Mutual labels:  i18n
Translation
The Translation component provides tools to internationalize your application.
Stars: ✭ 6,196 (+616.3%)
Mutual labels:  i18n
Aeiou
i18n scripts
Stars: ✭ 24 (-97.23%)
Mutual labels:  i18n
React Boilerplate
🔥 A highly scalable, offline-first foundation with the best developer experience and a focus on performance and best practices.
Stars: ✭ 28,151 (+3154.45%)
Mutual labels:  i18n
Int
Tiny in-browser internationalization.
Stars: ✭ 16 (-98.15%)
Mutual labels:  i18n
Ember I18n Changeset Validations
ember-i18n support for ember-changeset-validations messages
Stars: ✭ 11 (-98.73%)
Mutual labels:  i18n
Flask Humanize
Common humanization utilities for Flask applications
Stars: ✭ 26 (-96.99%)
Mutual labels:  i18n
Kiwi Linter
Lint your JavaScript files for literal strings usage (eg. Chinese) and replace them with one click
Stars: ✭ 19 (-97.8%)
Mutual labels:  i18n

Ruby I18n

Build Status

Ruby internationalization and localization (i18n) solution.

Currently maintained by @radar.

Usage

Rails

You will most commonly use this library within a Rails app.

See the Rails Guide for an example of its usage.

Ruby (without Rails)

If you want to use this library without Rails, you can simply add i18n to your Gemfile:

gem 'i18n'

Then configure I18n with some translations, and a default locale:

I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"]
I18n.default_locale = :en # (note that `en` is already the default!)

A simple translation file in your project might live at config/locales/en.yml and look like:

en:
  test: "This is a test"

You can then access this translation by doing:

I18n.t(:test)

You can switch locales in your project by setting I18n.locale to a different value:

I18n.locale = :de
I18n.t(:test) # => "Dies ist ein Test"

Features

  • Translation and localization
  • Interpolation of values to translations
  • Pluralization (CLDR compatible)
  • Customizable transliteration to ASCII
  • Flexible defaults
  • Bulk lookup
  • Lambdas as translation data
  • Custom key/scope separator
  • Custom exception handlers
  • Extensible architecture with a swappable backend

Pluggable Features

  • Cache
  • Pluralization: lambda pluralizers stored as translation data
  • Locale fallbacks, RFC4647 compliant (optionally: RFC4646 locale validation)
  • Gettext support
  • Translation metadata

Alternative Backend

  • Chain
  • ActiveRecord (optionally: ActiveRecord::Missing and ActiveRecord::StoreProcs)
  • KeyValue (uses active_support/json and cannot store procs)

For more information and lots of resources see the 'Resources' page on the wiki.

Tests

You can run tests both with

  • rake test or just rake
  • run any test file directly, e.g. ruby -Ilib:test test/api/simple_test.rb

You can run all tests against all Gemfiles with

  • ruby test/run_all.rb

The structure of the test suite is a bit unusual as it uses modules to reuse particular tests in different test cases.

The reason for this is that we need to enforce the I18n API across various combinations of extensions. E.g. the Simple backend alone needs to support the same API as any combination of feature and/or optimization modules included to the Simple backend. We test this by reusing the same API definition (implemented as test methods) in test cases with different setups.

You can find the test cases that enforce the API in test/api. And you can find the API definition test methods in test/api/tests.

All other test cases (e.g. as defined in test/backend, test/core_ext) etc. follow the usual test setup and should be easy to grok.

More Documentation

Additional documentation can be found here: https://github.com/ruby-i18n/i18n/wiki

Contributors

License

MIT License. See the included MIT-LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].