How to: Set locale (Time & Date display format)


I manage a handful of small Nextcloud instances in three countries in Europe, which means I deal with users with different language and locale settings. The default behavious for NC is to set these settings automagically, but sometimes it doesn’t play well with people’s browsers being in one language but TZ / locale in another. Because of this I will always set these settings manually.

How to!

If you want to make the default locale Sami, add the line

'default_locale' => 'se',

to config/config.php in your web root (standard location is /var/www/nextcloud)

The line needs to be after the opening of the config array

$CONFIG = array (

but before the closing bracket:

  'default_locale' => 'se',

I usually add the lines to the bottom as displayed above here.

This will make all time related words & formats in the Nextcloud instance in Sami, unless the user changes the setting themselves.

If you want to force a specific locale no matter the user preference (useful if the users are less technically inclined and you only have users in one locale), then add the line:

  'force_locale' => 'se',

as well / instead.

This git repo has the supported locales.

Be careful to use the proper locale as specified there, I had tried adding standard UTF locales prior to discovering this repo and they do not always match.

You do not need to restart php or apache2 for the setting to take effect.


1 Like