laralang 0.1.0

Localized routes for Laravel Rust: one route per language, translated paths, resources and hreflang alternates.
Documentation
use std::collections::HashMap;

use laravel::config::Section;

/// The package's configuration, the equivalent of `config/locales.php`.
///
/// The supported locales and the default one are not here: they are the `supported` and `locale`
/// settings of laralocale's `LocaleConfig`, where Laravel itself keeps `app.locale`. Set this
/// section in `src/app.rs` with `with_config`.
#[derive(Debug, Clone, Section)]
pub struct LaralangConfig {
    /// The locales that get routes. Empty means the `supported` locales of laralocale's
    /// `LocaleConfig`, or its `locale` alone when that is empty too.
    pub locales: Vec<String>,

    /// The literal URL prefix of each locale.
    ///
    /// A value is the prefix as it is written. Without one, the locale code is used, except for
    /// the default locale, which has no prefix. A missing key, an empty string and `None` all
    /// count as no value. Give the default locale a prefix of its own to prefix every language.
    pub prefixes: HashMap<String, String>,

    /// Rescue a URL that matches no route but exists under another locale, with a `301`, and send
    /// the root to the visitor's language when every language is prefixed.
    pub fallback: bool,

    /// The `Cache-Control: max-age` of the permanent redirects, in seconds.
    #[section(default = 86400)]
    pub redirect_max_age: u64,
}