• Stars
    star
    3,979
  • Rank 10,962 (Top 0.3 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 16 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff

Rails Locale Data Repository

Gem Version CI

Centralization of locale data collection for Ruby on Rails.

Gem Installation

Include the gem to your Gemfile:

gem 'rails-i18n', '~> 7.0.0' # For 7.0.0
gem 'rails-i18n', '~> 6.0' # For 6.x
gem 'rails-i18n', '~> 5.1' # For 5.0.x, 5.1.x and 5.2.x
gem 'rails-i18n', '~> 4.0' # For 4.0.x
gem 'rails-i18n', '~> 3.0' # For 3.x
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'master' # For 5.x
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-4-x' # For 4.x
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-3-x' # For 3.x

Alternatively, execute the following command:

gem install rails-i18n -v '~> 7.0.0' # For 7.0.0
gem install rails-i18n -v '~> 6.0' # For 6.x
gem install rails-i18n -v '~> 5.1' # For  For 5.0.x, 5.1.x and 5.2.x
gem install rails-i18n -v '~> 4.0' # For 4.0.x
gem install rails-i18n -v '~> 3.0' # For 3.x

Note that your Ruby on Rails version must be 3.0 or higher in order to install the rails-i18n gem. For rails 2.x, install it manually as described in the Manual Installation section below.

Configuration

Enabled modules

By default, all rails-i18n modules (locales, pluralization, transliteration, ordinals) are enabled.

If you would like to only enable specific modules, you can do so in your Rails configuration:

# to enable only pluralization rules, but disable all other features
config.rails_i18n.enabled_modules = [:pluralization]

# to enable pluralization and ordinals
config.rails_i18n.enabled_modules = [:pluralization, :ordinals]

The possible module names:

  • :locale
  • :ordinals
  • :pluralization
  • :transliteration

Setting enabled_modules will restrict the gem's loaded features to only the specific types.

Available locales

rails-i18n gem initially loads all available locale files, pluralization and transliteration rules. This default behaviour can be changed. If you specify in config/environments/* the locales which have to be loaded via I18n.available_locales option:

config.i18n.available_locales = ['es-CO', :de]

or

config.i18n.available_locales = :nl

Manual Installation

Download desired locale files found in rails/locale directory and move them into the config/locales directory of your Rails application.

If any translation doesn't suit well to the requirements of your application, edit them or add your own locale files.

For more information, visit Rails Internationalization (I18n) API on the RailsGuides.

Usage on Rails 2.3

Locale data whose structure is compatible with Rails 2.3 are available on the separate branch rails-2-3.

Available Locales

Available locales:

af, ar, az, be, bg, bn, bs, ca, cs, cy, csb, da, de, de-AT, de-CH, de-DE, dsb, dz, el, el-CY, en, en-AU, en-CA, en-CY, en-GB, en-IE, en-IN, en-NZ, en-TT, en-US, en-ZA, eo, es, es-419, es-AR, es-CL, es-CO, es-CR, es-EC, es-ES, es-MX, es-NI, es-PA, es-PE, es-US, es-VE, et, eu, fa, fi, fr, fr-CA, fr-CH, fr-FR, fur, fy, gd, gl, gsw-CH, he, hi, hi-IN, hr, hsb, hu, id, is, it, it-CH, ja, ka, kk, km, kn, ko, lb, lo, lt, lv, mg, mk, ml, mn, mr-IN, ms, nb, ne, nl, nn, oc, or, pa, pap-AW, pap-CW, pl, pt, pt-BR, rm, ro, ru, sc, scr, sk, sl, sq, sr, st, sv, sv-FI, sv-SE, sw, ta, te, th, tl, tr, tt, ug, uk, ur, uz, vi, wo, zh-CN, zh-HK, zh-TW, zh-YUE

Complete locales:

en, en-US, es, es-419, es-AR, es-CL, es-CO, es-CR, es-EC, es-ES, es-MX, es-NI, es-PA, es-PE, es-US, es-VE, fr, fr-CA, fr-CH, fr-FR, gd, ja, pt, pt-BR, ru, sc

Locales with missing pluralization rules

af, csb, dsb, dz, fur, gsw-CH, lb, rm, scr, sq, sv-FI, te, tt, ug, uz

Removed pluralizations:

ak, am, bh, bm, bo, br, by, cy, dz, ff, ga, gd, guw, gv, ig, ii, iu, jv, kab, kde, kea, ksh, kw, lag, ln, mo, mt, my, naq, nso, root, sah, se, ses, sg, sh, shi, sma, smi, smj, smn, sms, ti, to, tzm, wa, yo, zh

The above pluralization rules were removed because they did not have corresponding locale files.

Currently, most locales are incomplete. Typically they lack the following keys:

  • activerecord.errors.messages.record_invalid
  • activerecord.errors.messages.restrict_dependent_destroy.has_one
  • activerecord.errors.messages.restrict_dependent_destroy.has_many

The following keys should NOT be included:

  • errors.messages.model_invalid
  • errors.messages.required

We always welcome your contributions!

Currency Symbols

Some locales have the symbol of the currency (e.g. €) under the key number.currency.format.unit, while others have the code (e.g. CHF). The value of the key depends on the widespread adoption of the unicode currency symbols by fonts.

For example the Turkish Lira sign (β‚Ί) was recently added in Unicode 6.2 and while most popular fonts have a glyph, there are still many fonts that will not render the character correctly.

If you want to provide a different value, you can create a custom locale file under config/locales/tr.yml and override the respective key:

tr:
  number:
    currency:
      format:
        unit: TL

How to Contribute

Quick Contribution

If you are familiar with GitHub operations, then follow the procedures described in the subsequent sections.

If not,

  • Save your locale data in a Gist.
  • Open an issue with reference to the Gist you created.

Fetching the rails-i18n Repository

  • Get a github account and Git program if you haven't. See Help.Github for instructions.
  • Fork svenfuchs/rails-i18n repository and clone it into your PC.

Creating or Editing your Locale File

  • Have a look in rails/locale/en.yml, which should be used as the base of your translation.
  • Create or edit your locale file. Please pay attention to save your files as UTF-8.

Testing your Locale File

Before committing and pushing your changes, test the integrity of your locale file. (You can also run the tests using Docker, see below)

bundle exec rake spec

Make sure you have included all translations with:

bundle exec rake i18n-spec:completeness rails/locale/en.yml rails/locale/YOUR_NEW_LOCALE.yml

Make sure it is normalized with:

thor locales:normalize LOCALE # or "thor locales:normalize_all"

You can list all complete and incomplete locales:

thor locales:complete
thor locales:incomplete

Also, you can list all available locales:

thor locales:list

You can list all missing keys:

i18n-tasks missing es

Edit README.md

Add your locale name to the list in README.md if it isn't there.

Send pull request

If you are ready, push the repository into the Github and send us a pull request.

We will do the formality check and publish it as quick as we can.

Add an informative title to your pull request or issue

If your pull request or issue concerns a specific locale - please indicate the relevant locale in the issue or pull request title in order to facilitate triage.

Best:

Danish: change da.errors.messages.required to "skal udfyldes"

Good:

Human precision in Swedish locale file is set to 1

Update es-PE.yml, the currency unit is incorrect

Bad:

Changing some string about validation

Docker

Build the image:

docker build --tag=railsi18n .

Run the tests:

docker run railsi18n

To run the other commands described above:

docker run railsi18n bundle exec rake i18n-spec:completeness rails/locale/en.yml rails/locale/YOUR_NEW_LOCALE.yml

See also

License

MIT

Contributors

See https://github.com/svenfuchs/rails-i18n/contributors

Special thanks

Tsutomu Kuroda for untiringly taking care of this repository, issues and pull requests

More Repositories

1

gem-release

Release your ruby gems with ease.
Ruby
512
star
2

adva_cms

cutting edge cms, blog, wiki, forum ...
JavaScript
489
star
3

routing-filter

routing-filter wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation.
Ruby
463
star
4

i18n-active_record

I18n ActiveRecord backend
Ruby
281
star
5

adva-cms2

Cutting edge Rails 3 CMS framework
Ruby
115
star
6

hashr

Simple Hash extension to make working with nested hashes (e.g. for configuration) easier and less error-prone.
Ruby
109
star
7

simple_states

A super-slim statemachine-like support library
Ruby
95
star
8

steam

Headless integration testing w/ HtmlUnit: enables testing JavaScript-driven web sites
JavaScript
51
star
9

ripper2ruby

Similar to ruby2ruby this library allows to parse Ruby code, modify and recompile it back to Ruby.
Ruby
41
star
10

simple_opts.sh

Simple Bash option parser
Shell
31
star
11

i18n-missing_translations

Find missing translations in your code more easily.
Ruby
31
star
12

scriptaculous-sortabletree

Implements a sortable tree for scriptacolous
JavaScript
29
star
13

minimal

Minimal templating engine inspired by Markaby & Erector but much smaller and targeting Rails 3
Ruby
26
star
14

rdom

experimental browser implementation in ruby using nokogiri and johnson
Ruby
25
star
15

simple_nested_set

Ruby
22
star
16

space

multi-repository monitoring and shell helper tool to ease development across multiple dependent repositories
Ruby
17
star
17

activesupport-slices

Lazy loaded vertical code slices based on ActiveSupport Dependencies
Ruby
14
star
18

capture_stdout

Adds Kernel.capture_stdout(&block). Useful e.g. for testing command line tools
Ruby
14
star
19

data_migrations

Ruby
14
star
20

vim-tree

vim filesystem tree plugin in ruby
Ruby
13
star
21

rack-cache-purge

Support for purging rack-cache
Ruby
13
star
22

cl

Object-oriented OptionParser based CLI support for rapid CLI development
Ruby
12
star
23

i18n-tools

Tools for working with ruby/rails i18n
Ruby
10
star
24

vim-todo

Provides a simple todo list similar to Textmate’s todo.bundle
Ruby
10
star
25

reference_tracking

Ruby
10
star
26

locator

Generic html element locators for testing tools
Ruby
9
star
27

taskmate

Simplistic TextMate bundle for getting more done with your favorite missing text editor.
Ruby
9
star
28

scrumtious

toying with a remote scrum tool pulling from lighthouse for
Ruby
7
star
29

mephisto_paged_article_list

Mephisto doesn't page article lists out of the box. This plugin adds that.
Ruby
6
star
30

stubby

lightweight and fast stubbing framework
Ruby
6
star
31

with

highly experimental, lightweight and flexible contexts for test/unit
Ruby
6
star
32

resque-heartbeat

Ruby
6
star
33

activemodel-error

I18n support for validation error messages in ActiveModel
Ruby
6
star
34

vim-layout

Ruby
5
star
35

simple_slugs

Ruby
5
star
36

micro_migrations

Minimal ActiveRecord standalone migrations
Ruby
5
star
37

inherited_resources_helpers

Ruby
5
star
38

google_analytics

This plugin is primarily targeted at being used with Mephisto but should be useful with other Rails based CMS or blogging plattforms, too.
Ruby
5
star
39

test_server

Playing around with a test server for Rails that keeps the environment loaded (just like spec_server)
Ruby
5
star
40

will_paginate_liquidized

This plugin allows you to use will_paginate with Liquid templates. That's it.
Ruby
4
star
41

ruby-i18n.tmbundle

Ruby
4
star
42

middleman-toc

Ruby
4
star
43

rjb-require

Adds the ability to import and map Java packages to nested Ruby modules/classes to RJB.
Ruby
4
star
44

globalize-rails.org

Ruby
3
star
45

resque-tagged_queues

Ruby
3
star
46

sh_vars

Shell variable parser
Ruby
3
star
47

em-stdout

Ruby
3
star
48

rack-cache-tags

Support for tagging rack-cache entries
Ruby
3
star
49

rbac

Ruby
3
star
50

with-sugar

Test macros for being used with With
Ruby
3
star
51

treetop_css

Treetop CSS grammar/parser
Ruby
3
star
52

i18n-message

Object-oriented abstraction for looking up translations from I18n.translate
Ruby
3
star
53

adva-cms.org

Ruby
3
star
54

mephisto_tag_cloud

Most complete, sophisticated, standard-conform and allover-awesome implementation of a tag cloud plugin for Mephisto :)
Ruby
3
star
55

mephisto_full_archives

simple plugin that adds a full archives view to Mephisto's own archives
Ruby
2
star
56

bash_opts

SImple Bash options parser
Shell
2
star
57

test_declarative

Simply adds a declarative test method syntax to test/unit
Ruby
2
star
58

simple_taggable

Ruby
2
star
59

dotfiles

Vim Script
2
star
60

mephisto_inverse_captcha

Mephisto anti-comment-spam plugin that adds an "outer floodgate" to the existing (Akismet) spam-protection
Ruby
2
star
61

trsh

Experimental Travis CI Shell using API v3 in Go
Go
2
star
62

uki_reader

Experimental Google Reader UI based on Uki
JavaScript
2
star
63

travis

2
star
64

travis-lxc

Ruby
2
star
65

vim-deliminator

Balancing brackets and quotes
Ruby
1
star
66

database_recorder

Ruby
1
star
67

identity

Ruby
1
star
68

gmail_filters

Ruby
1
star
69

ruby-i18n.org

ruby-i18n.org - static html export, see the source branch for sources
Ruby
1
star
70

command

Ruby
1
star
71

registry

Ruby Class Registry
Ruby
1
star
72

travis-worker

Ruby
1
star
73

pathname_local

Ruby
1
star
74

dom-test

Ruby export of Level 1 and 2 W3C DOM tests
Ruby
1
star
75

led-go

A line editor in Go. Inspired by linenoise, but written with extensibility and separation of concerns in mind.
Go
1
star
76

svenfuchs.github.com

jo
HTML
1
star
77

rails-i18n-chart

Ruby
1
star
78

box

C++
1
star
79

statics

Ruby
1
star
80

silence_log_tailer

Silence rails/server log tailing to console
Ruby
1
star