locale

The Snap! locale environment includes three plugins.

Locale

The locale plugin is a very low level plugin that is used by others to setup the locale (language/country) and timezone (date/time) to be used on a hit from a client.

By default, the website is set to "en_US" and "America/Los Angeles" because we started the development of the Snap! system in California. However, a logged in user may have changed that locale to his own locale. The total list of available locales is defined using the list found on your server (some 460 on Linux at time of writing.) Also other plugins may have different rules and change the locale and timezone based on other basis such as the page content. For example, a website that talks about many big cities of the world, you could have a plugin that sets the locale and timezone based on the big city locale and timezone (i.e. "fr_FR" and "Europe/France" for the city of Paris).

Locale Widgets

The locale_widgets plugin is an extension to the editor plugin, which offers a few widgets one can use in his forms to allow the end user to select the locale and timezone. The widgets are used like other editor widgets. The result is a string that can directly be used with the locale plugin (i.e. "en_US" for the locale and "America/Los_Angeles" for the timezone.)

Locale Settings

The locale_settings plugin offers the Snap! Websites administrators a way to change the global locale and timezone of the website. By default the locale is set to "en_US" and the timezone is set to "America/Los_Angeles". The default is used whenever no other plugin wants to define its own locale and timezone (the users plugin is expected to do it whenever a user is logged in.)

This plugin makes use of the locale plugin to allow for the selection of the locale and the timezone. The global locale is then saved in the locale settings page (.../admin/settings/locale).

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly