View
505
Download
0
Category
Preview:
Citation preview
March 22nd 2016by @frederikvollert
Internationalization"i18n"
Internationalization"i#{'nternationalizatio'.length}n"
i18n: Preparing code for international audience"Hello!" can become "¡Hola!"
Uber becomes Über, or �berASCII or UTF-8 ?
.de or /de, Accept-Header
03/22/16 2pm PSTor 14:00h 22.03.2016 CET
Anybody got an IBAN or EC-Card?
Copy & Templates
Encoding
Routing & Language detection
Date & Time
Currency & Payment
Tips and Tricks
Prepare early! Use keys in templates from the start; Use constants and symbols instead of string values for e.g. <select> options
UI: Allow 20% stretching space for captions (Even more on buttons)
Every time should be stored as UTC
Money should be stored as integer amounts in smallest unit of currency (No float) with currency name
Make sure you use UTF-8 as encoding
Localization"l10n"
l10n: Adapting software to a specific locale
Translation of locale file (string file)
Support for local currency
Are your graphics, references and name culturally adequate?
Is your service legal in China? Tax?
pt-BR:welcome: "Oi!"
Does your PSP handle ¥ or € ?
Wix.com, Mitsubishi Pajero
"Salud" != "Oi"
br != pt-BR
Language code-Country code
Locale codes are well-defined(ISO 3166, ISO 639, RFC 5646)
en-GB, en-US, de-DE, pt-BR, pt-PT
Rails i18n support
I18n.t(:welcome, default: "Hello!", scope: [:home, :index])
Partial in path "app/views/home/index"
<h1>t(".welcome")</h1><h1>t("home.index.welcome")</h1>
I18n.l(@user.created_at, format: :long)Localized time and date notations
Pro-Tip: I18n.with_locale(temporary_locale) do … end
Placeholders
Pluralization
html-suffix
Rails i18n features
greeting: "Hello, %{name}!"
t(:greeting, name: "Frederik")
item:one: "%{count} item"other: "%{count} items"
t(:item, count: @items.length)
body_html: "<b>Statement!</b>"
Language detection
request.env["HTTP_ACCEPT_LANGUAGE"]
I18n.default_locale = :en
Routing param
(Store in cookie)config/routes.rb:
scope "/(:language)", language: /(en|de|fr)/ do get "features" => "home#features"end
Joining translated chunks is a bad idea (as are elaborate placeholders and YAML’s :<< )
SEOTop-level domain brand.de > brand.com/de or de.brand.comHowever, Page authority vs. Domain authority, Google vs. Facebook
Gettext as rails-i18n alternative: https://github.com/grosser/gettext_i18n_rails
Excel spreadsheet-driven processes will not work forever
Additional things to consider
Useful links & gems
Rails i18n guide
https://github.com/enriclluelles/route_translatorI18n routes: /en/cars becomes /de/autos
https://github.com/phrase/slimkeyfyExtract string file from .slim templates easily (Contributions welcome!)
https://github.com/phrase/phraseapp-in-context-editor-rubyIn-context editor for Rails applications
<5 minutesvia API
<12 hourswith 1-click
export
PhraseApp Translation Platform
Translate and edit copy inside your Rails app.
PhraseApp Rails In-Context Editor
FAMILO achieved 400% global user growth;surpassed 1 million users.
"PhraseApp helped us streamline our localization and become an industry leader."
Hauke Windmueller CEO, FAMILO
Thank you!
Frederik Vollert@frederikvollert+1 (650) 898-9785frederik@phraseapp.com
PhraseApp720 University AvePalo Alto
Recommended