Sep 29

Internationalization is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. Localization is the process of adapting internationalized software for a specific region or language by adding locale-specific components and translating text.

Due to the length of the words, the terms are frequently abbreviated to the numeronyms i18n (where 18 stands for the number of letters between the first i and last n in internationalization, a usage coined at DEC in the 1970s or 80s[1]) and L10n respectively. The capital L in L10n helps to distinguish it from the lowercase i in i18n.

Internationalization and localization instructions

Basic Terms

pot-file: Text file automatically generated with rake task (rake updatepo) or rgettext that shows all the original messages (msgid) inside the app code. Developers should generate this files and send them to translators as a template to write the po files (translated version of the pot file for a language).

po-file: Text file which is language-specific. It includes msgid(Original message) and msgstr(Translated message)

mo-file: Binary Files which are created from po-files with rake task (rake makemo) or rmsgfmt. The Ruby-GetText-Package library reads this compiled mo-files, not po-files.

File Maintenance

To do I18n maintenance, you need to install ruby-gettext-package

As it is not in the gem repository, you need to:
1) Download ruby-gettext-package- from here
2) Extract ruby-gettext-package-
3) Go to the extracted directory and run “sudo ruby setup.rb”

How to add a new language?:

1) create language directory inside “po” folder (eg: es/)
2) Go inside new language folder and run: msginit -i ../ur_application_name.pot -o ur_application_name.po

How to update po files (when new keys are added or modified)?:
1) Go to app folder and run: rake updatepo

To recompile files (when you get new/modifed po files translated)
1) Go to app folder and run: rake makemo

How to add i18n to a Page?


Basics

If you want to translate a text. Eg. “This text” You need to simple call _(). E.g _(“This text”).

The key will be added to the po file and someone will translate it later. If the key is already in the po file (and compiled in the mo file) it will appear translated. You should choose keys that make sense and that might be reusable. Try not to pick very long texts as keys.

Model: All field names are automatically added to the po file from the database (whith the rake task). If you need to define constants or translate new error messages, you can use the N_() function. For more information, check: http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html

written by admin

3 Pings to “Internationalization(I18n) and Localization(L10n) in Rails”

  1. Deep Wrinkle Cream For those who have a stronger anti-wrinkle Says:

    Wrinkle Cream For Men – Making The Best Choice | Secrets of anti ….

    Active outdoors for many years, most men show the signs of the sun on their face with deep wrinkles, skin discolorations and other skin imperfections….

  2. Working with a simple sealer | Best and Free tips on the Plastic ... Says:

    As the boat made of plastic weld on the grass | Best and Free tips ……

    HOW PLASTIC WELD Boat on the grass ? With MINI-WELD MODEL 6 plastic WELDER I was not able to find the price of this article. It costs about $ 15 to fix….

  3. WILLARD Says:


    PillSpot.org. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. Online Pharmacy. Order drugs online

    Buy:Super Active ED Pack.Soma.Viagra Super Force.Viagra Super Active+.Viagra Soft Tabs.VPXL.Tramadol.Cialis Super Active+.Maxaman.Cialis.Propecia.Zithromax.Viagra Professional.Levitra.Viagra.Cialis Soft Tabs.Cialis Professional….


17 Responses to “Internationalization(I18n) and Localization(L10n) in Rails”

  1. 1. oozttns Says:

    gmnJ2I plzhwitrrgnf, [url=http://iwqfnkbtjivk.com/]iwqfnkbtjivk[/url], [link=http://bghlbmlkgrls.com/]bghlbmlkgrls[/link], http://lxdunpqqrhce.com/

  2. 2. increase Says:

    car insurance quotes gwa life insurance wztrd cheap auto insurance 8-]] life insurance >:-O

  3. 3. subhead Says:

    car insurance quotes roern life insurance lnglwk cheap car insurance >:))) cheap health insurance bakury

  4. 4. liana Says:

    car insurance quotes 8-]]] life insurance >:((( auto insurance quotes wxwj

  5. 5. msonormal Says:

    life insurance rslwxd home insurance 1460 cheap health insurance 644201

  6. 6. tshering Says:

    cheap health insurance gait life insurance 657917 home insurance 8D life quotes 79720

  7. 7. sensors Says:

    tramadol online xxzwmx xanax online :-) buy ultram 26392 cialis levitra viagra =-DDD buy cialis 52859

  8. 8. christer Says:

    buy 150 tramadol swt xanax hcsnjb ultram 1525 discount phentermine :]]

  9. 9. dancing Says:

    pain pill ultram 71575 depakote tva xanax 8-]]] phentermine diet pills adejif

  10. 10. python Says:

    tramadol 4395 Prednisone 96022 generic cialis online 8-))) order depakote tjyf xanax and grapefruit nllkt

  11. 11. readonlyedit Says:

    xanax >:-(( viagra pills edevuj generic brands for ultram >:-)) cialis for sale luzgjs

  12. 12. christina Says:

    viagra 5932 generic xanax 8OO cialis %-DD what does xanax look like vynwmu

  13. 13. quinn Says:

    health insurance new york 1577 homeowners insurance quotes 429449 slots online =-PP life insurance quotes vfnbrd

  14. 14. esyktcu Says:

    UFqcmP ozhgilfzaznt, [url=http://yurruyscypnn.com/]yurruyscypnn[/url], [link=http://xekmsbxrrzqx.com/]xekmsbxrrzqx[/link], http://wsljylmppdsm.com/

  15. 15. take online surveys Says:

    If you liked this site you will probably like this site too: http://www.winfreegiftcardsonline.com . Its a great website for winning gift cards on the internet.

  16. 16. free paid surveys Says:

    If you enjoyed this post you’ll doubtless like this site too: http://www.winfreegiftcardsonline.com . Its a great website for earning gift vouchers on the internet.

  17. 17. Elliot Kesson Says:

    Howdy, your site is on air in the radio! Good job mate. Your posts are truly great and bookmarked. Regards

Leave a Reply