Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Internationalisation In Rails


Published on

Internationalisation In Rails presented at Ruby Fun Day!!

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Internationalisation In Rails

  2. 2. What is i18n and L10n <ul><li>i18n (short for Internationalization ) is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. </li></ul><ul><li>L10n (short for Localization) is the process of adapting software for a specific region or language by adding locale-specific components and translating text. </li></ul>
  3. 3. So What's The Difference <ul><li>Internationalization is the adaptation of products for potential use virtually everywhere, while localization is the addition of special features for use in a specific locale. </li></ul><ul><li>Internationalization is done once per product, while localization is done once for each combination of product and locale. </li></ul>
  4. 4. Cost Vs Benefit Tradeoff <ul><li>In a commercial setting, the benefit from localization is access to more markets. It costs more to produce products for international markets, but in an increasingly global economy, supporting only one language/market is scarcely an option. </li></ul><ul><li>Since open source software can generally be freely modified and redistributed, it is more prone to internationalization. The KDE project, for example, has been translated into over 100 languages. </li></ul>
  5. 5. Where Does Rails Come In <ul><li>Well, from version 2.2 Rails ships with the Ruby I18n gem which provides us with and easy to use and extensible framework and allows multi-language support for our applications. </li></ul><ul><li>The main focus of Rails I18n API is to provide support for English and similar languages out of the box and make it easy to customize and extend everything for other languages. </li></ul>
  6. 6. How Does It Work In Rails <ul><li>This module comes with the following features: </li></ul><ul><li>The main translation method #translate which is used to lookup translations. </li></ul><ul><li>The #localize method which is used to localize Date, DateTime and Time objects. </li></ul><ul><li>It stores a default locale which is used when no locale has been passed or set. </li></ul><ul><li>It stores a backend which carries the actual implementation for the translate and localize methods. </li></ul>
  7. 7. <ul><li>It comes with a default exception handler which catches exceptions that are raised in the backend. </li></ul><ul><li>Both the backend and the exception handler can be swapped with different implementations for cases where you need more flexibility and features. </li></ul>
  8. 8. Demo <ul><li>Lets look at two very basic apps, one uses Rails 2.1 and the Gibberish plugin and the other uses Rails 2.2 and the built in I18n API. </li></ul>
  9. 9. References <ul><li>I18n Wiki ( )‏ </li></ul><ul><li>Some text shamelessly copied from Wikipedia. :P </li></ul>