Setting up the locales of your Ubiquo Application

It’s sometimes required to build a multilanguage web application. For those cases, Ubiquo provides a plugin that uses the Rails I18n infrastructure to do so. In this post I’ll explain you how to set up the default locale for your application and how to tell Ubiquo how many languages you want to have support for.

By default, new Ubiquo projects are configured to use English (default), Catalan and Spanish languages. However, you may want to support more languages, or have a different default language instead of English. Both parameters are changed in the config/environment.rb file, using the Ubiquo Config framework:

Ubiquo::Config.set(:default_locale, :ca) will use Catalan as the default locale.

Ubiquo::Config.set(:supported_locales, %w[ca]) will set the supported locales of your application.

Keep in mind that the default locale must be one of the locales set up in the supported locales array. Also, be wary on changing those parameters outside of the environment file, since it might led to strange behaviours.