GithubHelp home page GithubHelp logo

isabella232 / rails-i18n Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shopify/rails-i18n

0.0 0.0 0.0 2.43 MB

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

Home Page: http://rails-i18n.org

License: MIT License

Ruby 100.00%

rails-i18n's Introduction

Rails Locale Data Repository

Gem Version Build Status

Centralization of locale data collection for Ruby on Rails.

Gem Installation

Include the gem to your Gemfile:

gem 'rails-i18n', '~> 6.0.0' # For 6.0.0 or higher
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 '~> 6.0.0' # For 6.0.0 or higher
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

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, da, de, de-AT, de-CH, de-DE, el, el-CY, en, en-AU, en-CA, en-GB, en-IE, en-IN, en-NZ, en-US, en-ZA, en-CY,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, gl, he, hi, hi-IN, hr, hu, id, is, it, it-CH, ja, ka, km, kn, ko, lb, lo, lt, lv, mk, ml, mn, mr-IN, ms, nb, ne, nl, nn, oc, or, pa, pl, pt, pt-BR, rm, ro, ru, sk, sl, sq, sr, sw, ta, te, th, tl, tr, tt, ug, ur, uz, vi, wo, zh-CN, zh-HK, zh-TW, zh-YUE

Complete locales:

af, da, de, de-AT, de-CH, de-DE, 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, et, fa, fr, fr-CA, fr-CH, fr-FR, id, ja, ka, ml, nb, nl, nn, pt, pt-BR, sv, sv-SE, tr, zh-CN, zh-HK, zh-TW, zh-YUE, uk

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
  • 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.

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

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

rails-i18n's People

Contributors

amatsuda avatar ariejan avatar digitalex avatar digitalfrost avatar fotos avatar hlaw avatar hron84 avatar huerlisi avatar jlduran avatar jofi avatar keang avatar kfl62 avatar kuroda avatar matthewtodd avatar mperrando avatar msdundar avatar nashbridges avatar netzpirat avatar neydroid avatar nkokkos avatar ozataman avatar pama avatar rbarazi avatar sikachu avatar silex avatar tigrish avatar tomhughes avatar tsechingho avatar weppos avatar yaroslav avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.