Locale feature (Date, Time, numbers, currency, etc.) [core]

Quite often, the system has to present some data to the end user.

This data is generally saved in a form that is common to anyone in the world: a number saved as an integer, a date saved as a Unix timestamp, a currency saved as a floating point, etc.

To display that information to the end user, the default format may not be adequat. For example a date may be writen in any one of the following formats:

26.11.2014  Europe
11.26.2014  US
2014.11.26  Japan

Similarly, the separator of digits in a number may be a comma, a period, a space...

(123) 555-1212       US Phone number
US $1,500,000.00     US currency
1 350,50 EUR         France currency

These variations are easily defined by a locale. Linux offers a complete set of locales for the whole world. We make that information available through the locale plugin. This allows users to select a locale or even enter their own format for each type of value (long date, short date, long time, short time, time with high precision, numbers, currency, etc.)

The locale plugin offers a set of settings that can be defined in the administration panel (/admin/locale). It also allows each user to select their own information. If you have an international website, then you probably want your users to be able to select their timezone so when they are presented a date and time, it is adjusted to their location on the planet.

Also, the locale plugin offers a set of widgets that extend the default editor widgets:

  • Locale Timezone
  • Locale Date
  • Locale Time
  • Locale Currency
  • Locale Number
  • Locale Plural
  • Locale Messages (with support for plural, gender, etc.)

The timezone offers two dropdowns to select the continent or country and then a city.

The date offers an easy to navigate calendar popup. The date widget accepts numbers and various separators: slash (/), period (.), dash (-), and spaces ( ).

The time offers a constrained format and supports leap seconds if necessary. It accepts numbers and colons.

The currency uses the user current locale to format the number. Currency numbers accept a sign, digits, and a decimal point. We also support the currency signs to switch between currencies (i.e. $, £, €, ¥, etc.)

The number uses the user current locale to format the number. Numbers accept a sign, digits, and a decimal point.

See: Editor feature [core]

See: Date/Time feature

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

Contact Us Directly