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

Sep 24

  GIT
   
What is Git?
    Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git was initially designed and developed by Linus Torvalds for Linux kernel development.
To install Git on Debian/Ubuntu based Linux distribution use

 apt-get install git-core 

     

Run once to create your local work branch

git checkout -b  

Then make changes and commit to local branch.

Commit good practices:

  • If you commit with git-gui, please inspect diff of every file included in the commit. You should not modify or delete any files that are not part of logic changes related to a task.
    If you do not have a gui program to commit, inspect diff from command line: git-status – check files that need to be added/removed and git-diff to inspect changed files.
  • Enter a good description for commit: first line should be a  summary up to 80 chars, other lines can contain more descriptive message, if commit is related to a ticket use re #ticket_number to automatically add a comment to the ticket with commit description.

To push to repository:

rake git:push

this command will update code from remote repository and will rebase your work branch with master, merge master branch  and it will push your changes to remote server.

To update the code from central repository

rake git:update
git checkout master
git checkout -b

commit your changes and after push this branch to remote

git push origin  
  • You want to copy one commit from other branch to current branch
    git checkout current_branch
    git cherry-pick sha_id_from_other_branch

    Using gitk: 

    1. right click on current branch and click check out this branch from popup menu
    2. click on commit from other branch, right-click and select Cherry-pick this commit
  • You forget to add some files to previous commit:
    git reset --soft HEAD^
    # do some changes, add files that you forget
    git commit -c ORIG_HEAD

    Using git-gui:

    1. Click Amend radio button above text area for commit description
    2. Add/remove files from commit
    3. Commit new changes

   

You can find more information regarding the Git here.
You can also find some useful miscellaneous git tools here

written by admin \\ tags: