Welcome to the
Movember DRUG
Meetup!!!
Wifi Network: Neutron-Guest
Wifi Password: welcome2u
About me
My name is Katherine
Muedas.
I am from Peru.
Software developer - I love
ruby on rails.
Bachelor Degree in Business
Management.
Passion: Marketing, fashion
and coding.
Also, I love playing Ping Pong,
spending time with family and
traveling.
I18n
Who can explain why
internationalization is
abbreviated as I18n?
I N T E R N A T I O N A L I Z A T I O N
I 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 N
What is
Internationalization?
What is I18n?
The process of "internationalization" usually means
to abstract all strings and other locale specific bits
(such as date or currency formats) out of your
application. The process of "localization" means to
provide translations and localized formats for these
bits.
Why Use It?
Why Use It?
Better UX
Makes your product or message more accessible
More customers == MOAR profits
For Translation… obviously
All your static text is in one spot.
Easy to maintain and change
Keep code DRY
Organization
Why Use It?
Let’s Get Started
Empezemos!
Setting Up Your Translation File
/config/locale/en.yml
/config/locale/es.yml
In Your Views…
views/home/_header.haml
You can do more than just put
words or sentences in the
translation file…
Nest translations for organization
config/locale/en.yml
views/home/_about
.html.haml
You can change a photo based on
language
config/locale/en.yml
views/home/_header.haml
and for spanish…
config/locale/es.yml
views/home/_header.haml
You can put HTML inside
config/locale/en.yml
Loop through a list
config/locale/en.yml views/about/_about.haml
Interpolation
config/locale/es.yml
views/about/_about.haml
webpage
Setting the Locale/
Language in your
Routes!
By Sub Domainen.mysite.com
Does not work on Heroku without a domain.
A wild card SSL certificate is more expensive then a single domain certificate
Supports localization by country or by language
Cookies can be shared across all locales.
Setting locale in your routes
es.mysite.com peru.mysite.com
Cons
Pros
By Top-Level Domain
Setting locale in your routes
mysite.com
Cons
Pros
Expensive and time consuming to buy many domains.
Cookies cannot be shared across multiple locales
Not a good option for localizing by language
Can not different languages for different countries.
Supports localization by country.
mysite.pe mysite.ca
By Paramsmysite.com?locale=en
Params get lost when redirecting
Bad for SEO
Quick to implement
Could be used to store locale
Info in a user cookie
Setting locale in your routes
mysite.com?locale=es
Cons
Pros
By Scoping Routesmysite.com/en/contact
Easy to set up for hosting.
Locale is set in the url route so it will not get lost when you are
navigating to different pages.
The locale is in a better position based on a architectural
standpoint.
Setting locale in your routes
mysite.com/es
Pros
How to setup scoped
routes ?
Application.rb
config/application.rb
Routes.rb
Optional language can be passed in
config/routes.rb
/admins/sign_in
/en/admins/sign_in
/es/admins/sign_in
Links to change language
Thank You!!
Top Related