10.4. Summary

If your application is on the World Wide Web, you may need to acknowledge the "world wide" part. Time and time zones are some of the first obstacles you'll face. Ruby has both Time and a DateTime classes, each with different strengths and weaknesses. In addition, there are a few Rails plugins that add more complex support for time zones.

Inputting time zones can be managed via the time_zone_select helper. The Ruby gem called Chronic, and the Rails plugin ActiveCalendar can both provide a richer experience for a user who is entering date information.

Globalize is the most feature-rich Rails plugin to manage internationalization of an application. It provides mechanisms to localize date and time references, and to translate content into different languages and display that content in the correct language given the user's locale. Translation can also be integrated directly into ActiveRecord, and local information can be embedded into Rails routing.

Get Professional Ruby on Rails™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.