Skip to main content

citum_schema_style/options/
localization.rs

1/*
2SPDX-License-Identifier: MIT OR Apache-2.0
3SPDX-FileCopyrightText: © 2023-2026 Bruce D'Arcus and Citum contributors
4*/
5
6#[cfg(feature = "schema")]
7use schemars::JsonSchema;
8use serde::{Deserialize, Serialize};
9
10/// Localization scope settings.
11#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
12#[cfg_attr(feature = "schema", derive(JsonSchema))]
13#[serde(rename_all = "kebab-case")]
14pub struct Localize {
15    pub scope: Scope,
16}
17
18impl Default for Localize {
19    fn default() -> Self {
20        Self {
21            scope: Scope::Global,
22        }
23    }
24}
25
26/// Localization scope.
27#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
28#[cfg_attr(feature = "schema", derive(JsonSchema))]
29#[serde(rename_all = "kebab-case")]
30pub enum Scope {
31    #[default]
32    Global,
33    PerItem,
34}
35
36/// Month display format.
37#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, Hash)]
38#[cfg_attr(feature = "schema", derive(JsonSchema))]
39#[serde(rename_all = "lowercase")]
40pub enum MonthFormat {
41    #[default]
42    Long,
43    Short,
44    Numeric,
45}