Skip to main content

chrono_node/locales/
mod.rs

1//! Locales. One module per language; each has `configuration.rs`, `parsers/` and `refiners/`.
2//!
3//! The hand-scaffolded languages are declared here. Generated languages
4//! (`harness/onboard/onboard.js`, a `locale.json` in their directory) are declared by `build.rs`,
5//! so onboarding one adds files and edits no shared line.
6
7use crate::core::chrono::Chrono;
8use crate::core::configuration::Configuration;
9
10pub mod de;
11pub mod en;
12pub mod es;
13pub mod fr;
14pub mod ja;
15pub mod pt;
16pub mod sv;
17
18/// A named configuration of a generated locale (`fi.casual`, ...).
19pub struct NamedConfiguration {
20    /// The upstream name, as in `tests/golden/configurations.json`.
21    pub name: &'static str,
22    /// The built `Chrono` (lazily, once).
23    pub chrono: fn() -> &'static Chrono,
24    /// The slot list, for the `configurations` test.
25    pub configuration: fn() -> Configuration,
26}
27
28include!(concat!(env!("OUT_DIR"), "/registry/locales.rs"));
29
30/// Every named configuration of the generated locales, in module order.
31pub fn generated() -> impl Iterator<Item = &'static NamedConfiguration> {
32    GENERATED.iter().flat_map(|named| named.iter())
33}