Logo

0x3d.Site

is designed for aggregating information.
Welcome
check repository here

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.

Ruby
Ruby
Ruby is a dynamic, object-oriented programming language known for its simplicity and productivity. It powers the Ruby on Rails framework, making it popular for web application development. Ruby emphasizes clean and readable code.
GitHub - TrestleAdmin/trestle: A modern, responsive admin framework for Ruby on Rails
GitHub - TrestleAdmin/trestle: A modern, responsive admin framework for Ruby on Rails
GitHub - ElMassimo/vite_ruby: ⚡️ Vite.js in Ruby, bringing joy to your JavaScript experience
GitHub - ElMassimo/vite_ruby: ⚡️ Vite.js in Ruby, bringing joy to your JavaScript experience
Rails Assets
Rails Assets
Avo
Avo
GitHub - mina-deploy/mina: Blazing fast deployer and server automation tool
GitHub - mina-deploy/mina: Blazing fast deployer and server automation tool
GitHub - rails/actionpack-action_caching: Action caching for Action Pack (removed from core in Rails 4.0)
GitHub - rails/actionpack-action_caching: Action caching for Action Pack (removed from core in Rails 4.0)
Awesome Ruby | LibHunt
Awesome Ruby | LibHunt
GitHub - palkan/action_policy: Authorization framework for Ruby/Rails applications
GitHub - palkan/action_policy: Authorization framework for Ruby/Rails applications
GitHub - pickhardt/betty: Friendly English-like interface for your command line. Don't remember a command? Ask Betty.
GitHub - pickhardt/betty: Friendly English-like interface for your command line. Don't remember a command? Ask Betty.
GitHub - metaskills/less-rails: :-1: Less.js For Rails
GitHub - metaskills/less-rails: :-1: Less.js For Rails
GitHub - codeplant/simple-navigation: A ruby gem for creating navigations (with multiple levels) for your Rails, Sinatra or Padrino applications.  Render your navigation as html list, link list or breadcrumbs.
GitHub - codeplant/simple-navigation: A ruby gem for creating navigations (with multiple levels) for your Rails, Sinatra or Padrino applications. Render your navigation as html list, link list or breadcrumbs.
GitHub - ruby/rake: A make-like build utility for Ruby.
GitHub - ruby/rake: A make-like build utility for Ruby.
GitHub - lazaronixon/authentication-zero: An authentication system generator for Rails applications.
GitHub - lazaronixon/authentication-zero: An authentication system generator for Rails applications.
GitHub - sorentwo/readthis: :newspaper: Pooled active support compliant caching with redis
GitHub - sorentwo/readthis: :newspaper: Pooled active support compliant caching with redis
GitHub - crepe/crepe: 🥞 The thin API stack.
GitHub - crepe/crepe: 🥞 The thin API stack.
GitHub - geemus/formatador: STDOUT text formatting
GitHub - geemus/formatador: STDOUT text formatting
GitHub - CanCanCommunity/cancancan: The authorization Gem for Ruby on Rails.
GitHub - CanCanCommunity/cancancan: The authorization Gem for Ruby on Rails.
GitHub - dry-rb/dry-cli: General purpose Command Line Interface (CLI) framework for Ruby
GitHub - dry-rb/dry-cli: General purpose Command Line Interface (CLI) framework for Ruby
The Ruby Toolbox - Know your options!
The Ruby Toolbox - Know your options!
GitHub - rharriso/bower-rails: Bundler-like DSL + rake tasks for Bower on Rails
GitHub - rharriso/bower-rails: Bundler-like DSL + rake tasks for Bower on Rails
GitHub - joshfrench/rakismet: Easy Akismet and TypePad AntiSpam integration for Rails
GitHub - joshfrench/rakismet: Easy Akismet and TypePad AntiSpam integration for Rails
GitHub - torba-rb/torba: Bundler for Sprockets
GitHub - torba-rb/torba: Bundler for Sprockets
GitHub - artsy/garner: A set of Rack middleware and cache helpers that implement various caching strategies.
GitHub - artsy/garner: A set of Rack middleware and cache helpers that implement various caching strategies.
GitHub - matthutchinson/acts_as_textcaptcha: Text-based logic question captcha's for Rails 🚫🤖
GitHub - matthutchinson/acts_as_textcaptcha: Text-based logic question captcha's for Rails 🚫🤖
GitHub - ai/autoprefixer-rails: Autoprefixer for Ruby and Ruby on Rails
GitHub - ai/autoprefixer-rails: Autoprefixer for Ruby and Ruby on Rails
GitHub - apneadiving/waterfall: A slice of functional programming to chain ruby services and blocks, thus providing a new approach to flow control. Make them flow!
GitHub - apneadiving/waterfall: A slice of functional programming to chain ruby services and blocks, thus providing a new approach to flow control. Make them flow!
GitHub - chaps-io/access-granted: Multi-role and whitelist based authorization gem for Rails (and not only Rails!)
GitHub - chaps-io/access-granted: Multi-role and whitelist based authorization gem for Rails (and not only Rails!)
MidiSmtpServer - brief profile
MidiSmtpServer - brief profile
GitHub - mdub/clamp: a Ruby command-line application framework
GitHub - mdub/clamp: a Ruby command-line application framework
GitHub - thoughtbot/administrate: A Rails engine that helps you put together a super-flexible admin dashboard.
GitHub - thoughtbot/administrate: A Rails engine that helps you put together a super-flexible admin dashboard.
Ruby
More on Ruby

Programming Tips & Tricks

Code smarter, not harder—insider tips and tricks for developers.

Error Solutions

Turn frustration into progress—fix errors faster than ever.

Shortcuts

The art of speed—shortcuts to supercharge your workflow.
  1. Collections 😎
  2. Frequently Asked Question's 🤯

Tools

available to use.

Made with ❤️

to provide resources in various ares.