Localization
Depending on your country, you might want to adapt some details in the configuration.
Some are defined in the locales (your language configuration). If this is the same in all the countries that speak your language, then you can change it directly in the translations. You can read more about how to contribute translations to Decidim). If the changes that you need are only for your country or your installation, then you need to configure it on your application. This page explains how to do that.
Date and time formats
These are defined in the YAML. You can read more about this in the Rails Internationalization (i18n) API and also in the Texts page.
Date
The following keys are relevant to date format:
date:
formats:
decidim_short: "%d/%m/%Y"
decidim_short_dashed: "%d-%m-%Y"
decidim_short_with_month_name_short: "%d %b %Y"
decidim_with_day_and_month_name: "%A %d %b %Y"
decidim_with_month_name: "%d %B %Y"
decidim_with_month_name_short: "%d %b"
help:
date_format: 'Format: dd/mm/yyyy'
If you need to change the format to comply with the United States of America standard, you must do the following:
-
Create or update the file
config/locales/en.ymlin your generated application. -
Add the following snippet:
en:
date:
formats:
decidim_short: "%m/%d/%Y"
decidim_short_dashed: "%m-%d-%Y"
decidim_short_with_month_name_short: "%b %d %Y"
decidim_with_day_and_month_name: "%A, %b %d %Y"
decidim_with_month_name: "%B %d %Y"
decidim_with_month_name_short: "%b %d"
help:
date_format: 'Format: mm/dd/yyyy'
-
Restart your application server.
The date picker derives both the order and the separator from the decidim_short format: the order comes from the sequence of its %d, %m and %Y directives, and the separator from the first character between them. There is no separate order or separator setting to configure. Only the d-m-y, m-d-y and y-m-d orders are supported, and the same separator character must be used between all three directives. Formats with other directive sequences or mixed separators are not supported and may result in an invalid date. In the example above, "%m/%d/%Y" results in the m-d-y order with the / separator.
Time
The following keys are relevant for time format:
time:
clock_format: 24
formats:
day_of_month: "%b %d"
day_of_week: "%a"
day_of_week_long: "%a %e"
day_of_year: "%d.%m.%y"
ddmm: "%d.%m"
ddmmyyyy: "%d.%m.%Y"
decidim_day_of_year: "%d %B %Y"
decidim_month: "%B"
decidim_month_and_year: "%B %Y"
decidim_short: "%d/%m/%Y %H:%M"
default: "%a, %d %b %Y %H:%M:%S %z"
devise:
mailer:
invitation_instructions:
accept_until_format: "%B %d, %Y %I:%M %p"
help:
time_format: 'Format: hh:mm'
long: "%B %d, %Y %H:%M"
long_dashed: "%Y-%m-%d %H:%M:%S"
long_with_particles: "%B %d, %Y at %H:%M"
short: "%d/%m/%Y %H:%M"
time_of_day: "%H:%M"
time_of_day_with_time_zone: "%H:%M %Z"
tooltip: "%d-%m-%Y %H:%M %Z (GMT %:z)"
By default, Decidim uses 24 hours format. If you want to switch to the 12-hour format, you must do the following:
-
Create or update the file
config/locales/en.ymlin your generated application. -
Add the following snippet:
en:
time:
clock_format: 12
formats:
day_of_month: "%b %d"
day_of_week: "%a"
day_of_week_long: "%a %e"
day_of_year: "%d.%m.%y"
ddmm: "%d.%m"
ddmmyyyy: "%d.%m.%Y"
decidim_day_of_year: "%d %B %Y"
decidim_month: "%B"
decidim_month_and_year: "%B %Y"
decidim_short: "%d/%m/%Y %I:%M %p"
default: "%a, %d %b %Y %I:%M:%S %p %z"
devise:
mailer:
invitation_instructions:
accept_until_format: "%B %d, %Y %I:%M %p"
help:
time_format: 'Format: hh:mm'
long: "%B %d, %Y %I:%M %p"
long_dashed: "%Y-%m-%d %I:%M:%S %p"
long_with_particles: "%B %d, %Y at %I:%M %p"
short: "%d/%m/%Y %I:%M %p"
time_of_day: "%I:%M %p"
time_of_day_with_time_zone: "%I:%M %p %Z"
tooltip: "%d-%m-%Y %I:%M %p %Z (GMT %:z)"
-
Restart your application server.
When using 12-hour format it is indicate to use also %p, the AM / PM indicator, to keep your application time clear (ex: 7:00 AM is different than 7:00 PM )
Currency unit
If you are using the Budget component or the Proposals' answers with costs feature, you may want to change the DECIDIM_CURRENCY_UNIT environment variable to a currency other than the default Euro (€). Read more about how to customize Environment Variables.
If you want to control where the currency unit (like €) and the number (like 999) is shown, then you can do that by changing the order of the values %u and %n (for unit and number respectively).
en:
number:
currency:
format:
format: "%u %n"
html_format: "<span>%u</span> %n"
Some examples:
-
"%u %n" → Shows it as € 999
-
"%n%u"→ Shows it as 999€
The html_format key is used in the budgets component to style better the unit.