✨ Añade soporte para localización y traducción
- Incluye recursos Fluent básicos y pruebas asociadas. - Nueva variable de configuración global para definir el idioma predeterminado.
This commit is contained in:
parent
efc4839613
commit
208ad83bea
13 changed files with 780 additions and 3 deletions
26
src/util.rs
Normal file
26
src/util.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
//! Funciones y macros útiles.
|
||||
|
||||
// MACROS ÚTILES ***********************************************************************************
|
||||
|
||||
#[macro_export]
|
||||
/// Macro para construir una colección de pares clave-valor.
|
||||
///
|
||||
/// ```rust
|
||||
/// use pagetop::hm;
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let args:HashMap<&str, String> = hm![
|
||||
/// "userName" => "Roberto",
|
||||
/// "photoCount" => "3",
|
||||
/// "userGender" => "male",
|
||||
/// ];
|
||||
/// ```
|
||||
macro_rules! hm {
|
||||
( $($key:expr => $value:expr),* $(,)? ) => {{
|
||||
let mut a = std::collections::HashMap::new();
|
||||
$(
|
||||
a.insert($key.into(), $value.into());
|
||||
)*
|
||||
a
|
||||
}};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue