The slides for @frederikvollert's talk at the #SFRAILS meetup in San Francisco. Typical best practices for i18n and l10n to translate and make your Rails application ready for an international audience. Looking to follow up with a step by step guide, what do you think?
4. i18n: Preparing code for international audience
"Hello!" can become "¡Hola!"
Uber becomes Über, or �ber
ASCII or UTF-8 ?
.de or /de, Accept-Header
03/22/16 2pm PST
or 14:00h 22.03.2016 CET
Anybody got an IBAN or EC-Card?
Copy & Templates
Encoding
Routing & Language detection
Date & Time
Currency & Payment
5. 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
7. 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
8. "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
9. 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
12. Joining translated chunks is a bad idea (as are elaborate placeholders and
YAML’s :<< )
SEO
Top-level domain brand.de > brand.com/de or de.brand.com
However, 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
17. 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
PhraseApp integrates into the developer’s toolchain and can extract source copy changes automatically from the source code management systems like GitHub. Content is immediately available for translation in PhraseApp’s online editor. It even allows in-context editing of the copy. Our customers either use in-house translators or our directly integrated providers, who will be able to translate 80% of orders within 12 hours.