CSC/ECE 517 Fall 2013/ch1 1w18 bs: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 53: Line 53:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Ruby 2.2  ! |Internationalization support was extended from this version of Rails.|
! Ruby 2.2  ! |Internationalization support was extended from this version of Rails.
|-| Example || Example || Example
|-| Example || Example || Example
|-
|-

Revision as of 19:18, 16 September 2013

Internationalization in Rails

Introduction

In general when we start a conversation, the first default language of communication we use is English, but if the other person is not familiar with English we try and translate our dialogue in a language that the person is familiar with. Similarly whenever we write a program or a document we write it in English by default. But what if someone who is not familiar with English wants to read your program or code? The simple solution is that we translate program or code into a language that the person is familiar with. And for this, we use a term called internationalization.
Internationalization is a way by which we can view an application in various languages without actually making changes to the code of the application. This saves us a lot of time and effort, as we don’t have to write or edit the same code or document in all the copies.
Internationalization has an acronym, rather more of a numeronym ,which is i18n where the number 18 represents the number of letters between the first and last letters in the word internationalization.

Aspects to consider in Internationalization

Now when we are to change our application according to a particular language or a region , we need to keep in mind numerous points that are important, implicit, particular or sensitive to that language or region. Like for example when we take a language into consideration for which our application needs to be translated, we need to consider the spoken and written aspects of that language. Also, there might be a case when we have the same language but it differs from one region to other. For this we need to keep in mind the typical change in the use of words, grammar and symbol for each region that uses the same language. Our application must also provide support for the varied writing conventions that differ from a language to another language or from one region to another.
Below are the examples of the points we need to keep in mind while we provide internationalization to our application :
  • Language :
Here the i18n support to an application needs to provide the character encoding keeping in mind the following points:
  1. The written language differs. For example most of the languages like English, French, German follow a script that can have inputs from a standard keyboard. But there are other languages like Hindi, Marathi, Sanskrit that follow a script called Devnagri and this cannot be directly typed in from a standard keyboard. So if we have to provide support for these languages we need to support the translation of the characters used in these scripts.
  2. The way we write also differs and needs to included in our i18n support. For example most of the languages follow a left-right direction while writing but some languages like Urdu tend to follow a right-left direction.
  3. The numbering symbols also vary from language to language. So when we display or accept any text with numbers, we must have i18n to support this mapping.
  4. The languages also differ in the use of grammar and structure of the sentences.For example the grammar rules and structure formation in English is way different than the one followed by another language like Sanskrit.
  • Culture and Writing Conventions:
Even if the language with the same characters and grammar is used, the use of the language , the symbols , the way of writing and many other things change with change in the region.
Following are some of the examples:
  1. There are some cultures that have some regulations about having a middle name as father’s name but other cultures don’t necessary include the middle name.
  2. There might be cases when there are different names or terminologies used in different cultures for the same purpose. For example, to identify a citizen uniquely US has the system of SSN while India is in the process of implementing this by using the term as Aadhar number.
  3. Another example of difference in the writing convention can be taken as that of a postal code. Some countries have 6 digit postal codes while others have 5.
  4. There is a difference in the use of many other things like the currency(like INR,dollars,Euro) used, the symbols(€,$,₹) used , the units in which the weights , temperature are measured. Another example could be the use of lakhs , crores for mentioning any financial figures in some countries while others use millions, billions.
  5. There could also be a difference in the formats used for a same thing. For example the format of writing dates and times vary from one region to another.
  • We also have to be careful that we cover all the sensitive topics and issues particular to a language or region.
Similarly there are many other factors that we need to take care of when we support internationalization for a particular language in a particular region.

Internationalization in Rails

Internationalization support was extended from Rails version 2.2. So in order to internationalize a rails application, it has to be migrated :to Rails 2.2 or above. Every static string in the Rails framework — e.g. Active Record validation messages, time and date formats — have :been internationalized.

Internationalization features provided in each version if Rails

Ruby 2.2
Internationalization support was extended from this version of Rails.
Example Example Example
Example Example Example