diff options
author | Christian Breunig <christian@breunig.cc> | 2023-08-01 17:21:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-01 17:21:38 +0200 |
commit | 1429fe3750258cbbd947c065d92b867c785d461f (patch) | |
tree | 1278fec51b9c83662c0c6e5e9711c1c033643e1a /src/conf_mode/system-option.py | |
parent | ca8eba2f9f9146a14373345bc03a46395ddd349a (diff) | |
parent | 7fd6d8c0e99ff4cb566598af65d8915c658ed749 (diff) | |
download | vyos-1x-1429fe3750258cbbd947c065d92b867c785d461f.tar.gz vyos-1x-1429fe3750258cbbd947c065d92b867c785d461f.zip |
Merge pull request #2124 from sever-sever/T5374
T5374: Add system option time-format 12 or 24 hours
Diffstat (limited to 'src/conf_mode/system-option.py')
-rwxr-xr-x | src/conf_mode/system-option.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/conf_mode/system-option.py b/src/conf_mode/system-option.py index 5172b492e..1495e9223 100755 --- a/src/conf_mode/system-option.py +++ b/src/conf_mode/system-option.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2019-2022 VyOS maintainers and contributors +# Copyright (C) 2019-2023 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -36,6 +36,11 @@ airbag.enable() curlrc_config = r'/etc/curlrc' ssh_config = r'/etc/ssh/ssh_config.d/91-vyos-ssh-client-options.conf' systemd_action_file = '/lib/systemd/system/ctrl-alt-del.target' +time_format_to_locale = { + '12-hour': 'en_US.UTF-8', + '24-hour': 'en_GB.UTF-8' +} + def get_config(config=None): if config: @@ -143,6 +148,11 @@ def apply(options): else: cmd('systemctl disable root-partition-auto-resize.service') + # Time format 12|24-hour + if 'time_format' in options: + time_format = time_format_to_locale.get(options['time_format']) + cmd(f'localectl set-locale LC_TIME={time_format}') + if __name__ == '__main__': try: c = get_config() |