Localizing a non-trivial application can be a huge undertaking. This card will give you an overview over the many components that are affected.
When you are asked to give an estimate for the effort involved, go through the list below and check which points are covered by your requirements. Work with a developer who has done a full-app localization before and assign an hour estimate to each of these points.
Static strings and template text in app
must be translated: Screens, mailer templates, PDF templates, helpers, sometimes models.
Use the native Rails I18n API Show archive.org snapshot . Avoid Gettext if possible.
Native I18n has good integration with Rails (you already have it!), but you need to come up with consistent variable names for all translated strings. Use it if the number of translated strings is limited.
config/locales/de.yml
). There's an awesome gem
rails-i18n
Show archive.org snapshot
that gives you default dictionaries for many languages.pluralize
helper
Show archive.org snapshot
or the default validation error messages (humanized attribute name + error message) make assumptions about sentence structure which are not true in all languages. In such cases you must intervene with custom error messages and additional dictionary entries.<html>
a lang
attribute and use that to scope language-specific style declarations.order_button.de.png
and order_button.en.png
.Article#name
becomes Article#name_de
and Article#name_en
and Article#name
returns the variant in the current locale.Article#name_de
.Accept-Language
HTTP header. Note that even the best default never replaces a language switcher./messages/new
becomes /nachrichten/neu
. You can do that with vanilla Rails router options. I recommend to only localize routes that are at the center of the user experience, e.g. URLs the user would print, bookmark or share with friends./articles/1033-colorful-scarf
you might want this to localize that to e.g. /articles/1033-farbenfroher-schal
./en/users/5003
and a /de/users/5003
. The
routing-filter
Show archive.org snapshot
gem comes with a filter that helps you with that. You must also handle the case where the user has switched to language de
but accesses a /en/foo
URL (redirect or let the URL win).config/locales/de.yml
). They already do for dates, times, numbers and money amounts.I18n.l
that can convert date and time values according to the rules of the current locale dictionary. Unfortunately you need to roll your own helpers for all other types of values (e.g. numbers, currencies).I18n
class in Javascript.