macOS: Add support for 12/24-hour time display preferences

This commit is contained in:
Jamie Kyle
2023-07-31 09:23:19 -07:00
committed by GitHub
parent 88858af144
commit 1143c0e9ba
17 changed files with 208 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { z } from 'zod';
import type { LocalizerType } from './Util';
export type { LocalizerType } from './Util';
@@ -35,3 +36,11 @@ export type LocaleType = {
i18n: LocalizerType;
messages: LocaleMessagesType;
};
export enum HourCyclePreference {
Prefer24 = 'Prefer24', // either h23 or h24
Prefer12 = 'Prefer12', // either h11 or h12
UnknownPreference = 'UnknownPreference',
}
export const HourCyclePreferenceSchema = z.nativeEnum(HourCyclePreference);

View File

@@ -5,6 +5,7 @@ import { z } from 'zod';
import { Environment } from '../environment';
import { themeSettingSchema } from './StorageUIKeys';
import { HourCyclePreferenceSchema } from './I18N';
const environmentSchema = z.nativeEnum(Environment);
@@ -46,6 +47,7 @@ export const rendererConfigSchema = z.object({
osVersion: configRequiredStringSchema,
resolvedTranslationsLocale: configRequiredStringSchema,
resolvedTranslationsLocaleDirection: z.enum(['ltr', 'rtl']),
hourCyclePreference: HourCyclePreferenceSchema,
preferredSystemLocales: z.array(configRequiredStringSchema),
name: configRequiredStringSchema,
nodeVersion: configRequiredStringSchema,

View File

@@ -5,7 +5,7 @@ import type { IntlShape } from 'react-intl';
import type { UUIDStringType } from './UUID';
import type { LocaleDirection } from '../../app/locale';
import type { LocaleMessagesType } from './I18N';
import type { HourCyclePreference, LocaleMessagesType } from './I18N';
export type StoryContextType = {
authorUuid?: UUIDStringType;
@@ -28,6 +28,7 @@ export type LocalizerType = {
getLocale(): string;
getLocaleMessages(): LocaleMessagesType;
getLocaleDirection(): LocaleDirection;
getHourCyclePreference(): HourCyclePreference;
};
export enum SentMediaQualityType {