ProductPromotion
Logo

Ruby

made by https://0x3d.site

GitHub - ruby-i18n/i18n: Internationalization (i18n) library for Ruby
Internationalization (i18n) library for Ruby. Contribute to ruby-i18n/i18n development by creating an account on GitHub.
Visit Site

GitHub - ruby-i18n/i18n: Internationalization (i18n) library for Ruby

GitHub - ruby-i18n/i18n: Internationalization (i18n) library for Ruby

Ruby I18n

Gem Version 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.

We support Rails versions from 6.0 and up.

See the Rails Guide for an example of its usage.

Ruby (without Rails)

We support Ruby versions from 3.0 and up.

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

  • @radar
  • @carlosantoniodasilva
  • @josevalim
  • @knapo
  • @tigrish
  • and many more

License

MIT License. See the included MIT-LICENSE file.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory