How to customize a locale?

Nextcloud version (eg, 29.0.5): 29.0.4.1
Operating system and version (eg, Ubuntu 24.04): Alpine 3.20.2
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.62
PHP version (eg, 8.3): Zend Engine v4.2.21

The issue you are facing:

I just installed Nextcloud AIO. I was using the calendar web app, and found much to my chagrin the times in AM/PM format. It seems by changing the locale to English (UK) one can change to a normal clock format, but now it shows weeks starting on Monday.

I found this thread: 24 Hour Time in Calendar

So at the risk of an XY problem (please let me know if this is), it seems the only way to have 24-hour time format and weeks starting on Sunday is to customize a locale.

It seems the first day of week knob is called “firstDayOfWeek”, appropriately enough. However i can’t find where it is defined. I am looking thru files in the nextcloud container, and it’s like seeking a needle in a haystack. The files in the l10n directories seem to only contain translations.

I thought to look in the nextcloud repos for where this is defined, but i’m not sure which repo…

So, how can i define/customize a locale? In particular, to set clock format and first day of week in Calendar

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Install Nextcloud AIO
  2. Open calendar

The output of your Nextcloud log in Admin > Logging:

"Aug 23, 2024, 8:02:27 AM"	
Warning	no app in context	
Login failed: m (Remote IP: 127.0.0.1)
"Aug 22, 2024, 5:25:10 PM"	
Error	no app in context	
Exception HMAC does not match.
Could not decrypt or decode encrypted session data
"Aug 22, 2024, 5:21:15 PM"	
Error	no app in context	
Exception HMAC does not match.
Could not decrypt or decode encrypted session data
"Aug 22, 2024, 5:06:54 PM"	
Error	core	
NotFoundException /appdata_oc52g7upn5p1/theming/global
Error while running background job OCA\Theming\Jobs\MigrateBackgroundImages (id: 96, arguments: {"stage":"prepare"})
"Aug 12, 2024, 4:51:24 PM"	
Fatal	spreed	
RuntimeException There can only be one Talk backend
Error during app service registration: There can only be one Talk backend
"Aug 12, 2024, 4:50:43 PM"	
Error	PHP	
fopen(/var/www/html/config/config.php): Failed to open stream: No such file or directory at /var/www/html/lib/private/Config.php#221
"Aug 12, 2024, 4:49:35 PM"	
No older log entries available 

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'check_data_directory_permissions' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => 'nope',
    'port' => 6379,
  ),
  'overwritehost' => 'example.org',
  'overwriteprotocol' => 'https',
  'passwordsalt' => 'nope',
  'secret' => 'nope',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'example.org',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '29.0.4.1',
  'overwrite.cli.url' => 'https://example.org/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => 'nope',
  'installed' => true,
  'instanceid' => 'nope',
  'maintenance' => false,
  'loglevel' => 2,
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'log_rotate_size' => 10485760,
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'jpeg_quality' => 60,
  'enabledPreviewProviders' =>
  array (
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
    0 => 'OC\\Preview\\Imaginary',
  ),
  'enable_previews' => true,
  'upgrade.disable-web' => true,
  'mail_smtpmode' => 'smtp',
  'trashbin_retention_obligation' => 'auto, 30',
  'versions_retention_obligation' => 'auto, 30',
  'activity_expire_days' => 30,
  'simpleSignUpLink.shown' => false,
  'share_folder' => '/Shared',
  'one-click-instance.link' => 'https://nextcloud.com/all-in-one/',
  'upgrade.cli-upgrade-link' => 'https://github.com/nextcloud/all-in-one/discussions/2726',
  'updatedirectory' => '/nc-updater',
  'maintenance_window_start' => 100,
  'allow_local_remote_servers' => true,
  'davstorage.request_timeout' => 3600,
  'htaccess.RewriteBase' => '/',
  'dbpersistent' => false,
  'auth.bruteforce.protection.enabled' => true,
  'ratelimit.protection.enabled' => true,
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '::1',
    10 => '172.18.0.0/16',
  ),
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'preview_imaginary_key' => 'nope',
);

The output of your Apache/nginx/system log in /var/log/____:

not sure which container this is in… no such logs in nextcloud-aio-apache

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

again, not sure where this file is… it’s not in either nextcloud-aio-apache or nextcloud-aio-nextcloud.

Edit:
A friend of mine figured out how to solve the first-day-of-week problem.
In nextcloud-aio-nextcloud container, in /var/www/html/lib/private/Template/JSConfigHelper.php, change from "firstDay" => json_encode($this->l->l('firstday', null)), to "firstDay" => json_encode(0), (to start on Sunday).

However, i would also like big-endian date format (YYYY-MM-DD; en_GB is little-endian, DD/MM/YYYY) and it seems a custom locale would be useful for that also. (I normally use custom locales on my systems anyhow.)

The date, time and day of week configuration usually depends on the settings you’ve applied to your underlying Linux system. If the right settings are configured, Nextcloud will automatically use it.

So first of all, it is important to know in which time region you are living.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.