🚚 Homogeiniza uso de archivos de localización

This commit is contained in:
Manuel Cillero 2023-06-21 23:14:27 +02:00
parent bf3b546640
commit aa1f58d11a
27 changed files with 29 additions and 30 deletions

View file

@ -2,7 +2,7 @@ use pagetop::prelude::*;
define_handle!(MODULE_ADMIN); define_handle!(MODULE_ADMIN);
define_locale!(LOCALE_ADMIN, "src/locales"); define_locale!(LOCALE_ADMIN, "src/locale");
mod summary; mod summary;

View file

@ -1,3 +1,3 @@
fn main() -> std::io::Result<()> { fn main() -> std::io::Result<()> {
pagetop_build::bundle_resources("./static/theme", "bootsier", None) pagetop_build::bundle_resources("./static", "bootsier", None)
} }

View file

@ -2,7 +2,7 @@ use pagetop::prelude::*;
define_handle!(THEME_BOOTSIER); define_handle!(THEME_BOOTSIER);
define_locale!(LOCALE_BOOTSIER, "static/locales"); define_locale!(LOCALE_BOOTSIER, "src/locale");
include!(concat!(env!("OUT_DIR"), "/bootsier.rs")); include!(concat!(env!("OUT_DIR"), "/bootsier.rs"));

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

View file

@ -3,7 +3,7 @@ use pagetop_minimal::component::*;
define_handle!(MODULE_DEMOHOME); define_handle!(MODULE_DEMOHOME);
define_locale!(LOCALE_DEMOHOME, "src/locales"); define_locale!(LOCALE_DEMOHOME, "src/locale");
include!(concat!(env!("OUT_DIR"), "/homedemo.rs")); include!(concat!(env!("OUT_DIR"), "/homedemo.rs"));

View file

@ -2,7 +2,7 @@ use pagetop::prelude::*;
define_handle!(MODULE_NODE); define_handle!(MODULE_NODE);
define_locale!(LOCALE_NODE, "src/locales"); define_locale!(LOCALE_NODE, "src/locale");
//mod entity; //mod entity;
mod migration; mod migration;

View file

@ -3,7 +3,7 @@ use pagetop_minimal::component::*;
define_handle!(MODULE_USER); define_handle!(MODULE_USER);
define_locale!(LOCALE_USER, "src/locales"); define_locale!(LOCALE_USER, "src/locale");
mod migration; mod migration;

View file

@ -117,7 +117,7 @@ pub type HashMapResources = std::collections::HashMap<&'static str, StaticResour
pub type Handle = u64; pub type Handle = u64;
define_locale!(LOCALE_PAGETOP, "static/locales"); define_locale!(LOCALE_PAGETOP, "src/locale");
// ************************************************************************************************* // *************************************************************************************************
// APIs PÚBLICAS. // APIs PÚBLICAS.

View file

@ -13,30 +13,29 @@
//! //!
//! # Recursos Fluent //! # Recursos Fluent
//! //!
//! PageTop utiliza [fluent-templates](https://docs.rs/fluent-templates/) para integrar durante la //! PageTop usa [fluent-templates](https://docs.rs/fluent-templates/) para integrar los recursos de
//! compilación los recursos de localización en el binario de la aplicación. En el siguiente ejemplo //! localización en el binario de la aplicación. El siguiente ejemplo agrupa archivos y subcarpetas
//! agruparía todos los archivos y subdirectorios de *static/locales* que tienen un //! de *src/locale* que tienen un [Identificador de Idioma Unicode](https://docs.rs/unic-langid/)
//! [Identificador de Idioma Unicode](https://docs.rs/unic-langid/) válido y los asignaría a su //! válido y los asigna a su identificador correspondiente:
//! identificador correspondiente:
//! //!
//! ```text //! ```text
//! static/locales //! src/locale/
//! ├── common.ftl //! ├── common.ftl
//! ├── en-US //! ├── en-US/
//! │ ├── default.ftl //! │ ├── default.ftl
//! │ └── main.ftl //! │ └── main.ftl
//! ├── es-ES //! ├── es-ES/
//! │ ├── default.ftl //! │ ├── default.ftl
//! │ └── main.ftl //! │ └── main.ftl
//! ├── es-MX //! ├── es-MX/
//! │ ├── default.ftl //! │ ├── default.ftl
//! │ └── main.ftl //! │ └── main.ftl
//! └── fr //! └── fr/
//! ├── default.ftl //! ├── default.ftl
//! └── main.ftl //! └── main.ftl
//! ``` //! ```
//! //!
//! Ejemplo de un archivo *static/locales/en-US/main.ftl*: //! Ejemplo de un archivo *src/locale/en-US/main.ftl*:
//! //!
//! ```text //! ```text
//! hello-world = Hello world! //! hello-world = Hello world!
@ -52,7 +51,7 @@
//! }. //! }.
//! ``` //! ```
//! //!
//! Ejemplo del archivo equivalente *static/locales/es-ES/main.ftl*: //! Ejemplo del archivo equivalente *src/locale/es-ES/main.ftl*:
//! //!
//! ```text //! ```text
//! hello-world = Hola mundo! //! hello-world = Hola mundo!
@ -76,9 +75,9 @@
//! ``` //! ```
//! use pagetop::prelude::*; //! use pagetop::prelude::*;
//! //!
//! define_locale!(LOCALE_SAMPLE, "static/locales"); //! define_locale!(LOCALE_SAMPLE, "src/locale");
//! ``` //! ```
//! Y utiliza el componente [L10n](crate::base::component::L10n) para incluir, en respuestas a las //! Y usa el componente [L10n](crate::base::component::L10n) para incluir en las respuestas a
//! peticiones web, textos y contenidos opcionalmente traducibles según el contexto de renderizado. //! peticiones web, textos y contenidos opcionalmente traducibles según el contexto de renderizado.
use crate::{args, config, trace, LazyStatic}; use crate::{args, config, trace, LazyStatic};