1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//! This module contains structures and traits for working with locales and localization.
pub use crate;
use HashMap;
use Arc;
/// Represents various types of values associated with a locale.
///
/// `LocaleValue` is an enum that allows for storage and handling of multiple data types.
/// This can be useful in scenarios where locale-specific values need to support different kinds of data.
///
/// Variants:
/// - `String(String)`: Stores a UTF-8 encoded string value.
/// - `Uint(usize)`: Stores an unsigned integer value.
/// - `Int(isize)`: Stores a signed integer value.
/// - `Float(f64)`: Stores a floating-point number value.
///
/// The `Clone` trait is implemented for `LocaleValue`, allowing instances of this enum to be duplicated.
///
/// Example:
/// ```
/// use cjtoolkit_structured_validator::common::locale::LocaleValue;
/// let string_locale = LocaleValue::String(String::from("Hello"));
/// let unsigned_locale = LocaleValue::Uint(42);
/// let signed_locale = LocaleValue::Int(-7);
/// let float_locale = LocaleValue::Float(3.14);
///
/// match string_locale {
/// LocaleValue::String(s) => println!("String value: {}", s),
/// _ => println!("Not a string"),
/// }
/// ```
/**
* Represents the localization data for a specific locale.
* This structure holds locale-specific information, such as the locale's name
* and associated arguments or values used for localization.
*/
/// A trait representing a localized message provider that offers locale-specific data.
///
/// Types that implement this trait are expected to provide a mechanism for retrieving
/// locale-specific data useful for internationalization or localization purposes. Implementers must
/// be `Send` and `Sync` to ensure safe usage in concurrent environments.
///
/// # Required Methods
///
/// - `get_locale_data`: Retrieves locale-specific information encapsulated in a `LocaleData` object.
///
/// # Example
///
/// ```rust
/// use std::sync::Arc;
/// use cjtoolkit_structured_validator::common::locale::{LocaleMessage, LocaleData};
///
/// struct MyLocaleMessage;
///
/// impl LocaleMessage for MyLocaleMessage {
/// fn get_locale_data(&self) -> Arc<LocaleData> {
/// LocaleData::new("validate-example")
/// }
/// }
///
/// let locale_message = MyLocaleMessage;
/// let locale_data = locale_message.get_locale_data();
/// ```
///
/// # Notes
///
/// This trait is designed to be used in scenarios where thread-safe and cross-thread access
/// to locale information is necessary.