infusionvlc/ConexionFelina

View on GitHub
docs/i18n.md

Summary

Maintainability
Test Coverage
# Translations

So you want to help us translate the app to another language?
Here you'll find some advice :wink:

## How internationalization works in ruby on rails?

RoR use I18n, is easy to configure, we just add the string in
the .yml of the language.

## Where are the .yml of each language?

The .yml of each language are in `config/locales/`, there can be added all
the .yml as `[language_code].yml` you can see
[here](https://es.wikipedia.org/wiki/ISO_639-1) the code of all the languages.

## How we organice the values of the .yml
We encapsulate the values by HTML elements such as cats, users, sufferings etc.
in the second level of the hierarchy.

For example:
```
es:
  [...]
  cats:
    birthDate: 'Nacido aproximadamente el'
    gender: 'Género:'
    sterilized: 'Esterilizado:'
    abandonedDate: 'Abandonado aproximadamente el'
    document: 'Documento:'
```

## How add the values to the HTML code.
We just need to add a line like this in our HTML file
`<%= I18n.t 'cats.sterilized'%>`, this line will show `Esterilizado:`

### Sources
Our es.yml: https://github.com/infusionvlc/ConexionFelina/blob/master/config/locales/es.yml

Example: https://github.com/infusionvlc/ConexionFelina/blob/master/app/views/cats/index.html.erb

Language codes: https://es.wikipedia.org/wiki/ISO_639-1

Source: http://guides.rubyonrails.org/i18n.html