However, there are also regional differences within different language groups that may be important. Many international applications use only the "language" element of a locale such as :cs, :th, or :es (for Czech, Thai, and Spanish). The i18n library takes a pragmatic approach to locale keys (after some discussion), including only the locale ("language") part, like :en, :pl, not the region part, like :"en-US" or :"en-GB", which are traditionally used for separating "languages" and "regional setting" or "dialects". The default en.yml locale in this directory contains a sample pair of translation strings: yml files from the config/locales directory to the translations load path, automatically. When different translation strings are needed, they can be overridden. 2.1 Configure the I18n Moduleįollowing the convention over configuration philosophy, Rails I18n provides reasonable default translation strings. There are a few steps to get up and running with I18n support for a Rails application. So, let's internationalize a simple Rails application from the ground up in the next chapters! 2 Setup the Rails Application for Internationalization Load_path # Announce your custom translation files locale # Get and set the current locale default_locale # Get and set the default locale available_locales # Permitted locales available for the application enforce_available_locales # Enforce locale permission (true or false) exception_handler # Use a different exception_handler backend # Use a different backend Copy
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |