Skip to content

Commit

Permalink
feat: update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
yassun7010 committed Jun 22, 2024
1 parent 036b524 commit 78c607f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion serde_valid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ assert_eq!(

You can also use [fluent](https://projectfluent.org/) localization by using `fluent` feature.

Allow the following attributes:
- `#[validate(..., message_l10n = fluent("message-id", key1 = value1, ...))]`
- `#[validate(..., fluent("message-id", key1 = value1, ...))]`

```rust
use unic_langid::LanguageIdentifier;
use serde_json::json;
Expand All @@ -185,7 +189,6 @@ use serde_valid::{fluent::Localize, Validate};
#[derive(Validate)]
struct Data (
#[validate(min_length = 3, message_l10n = fluent("name-min-length", min_length = 3))]
// Or Just `#[validate(min_length = 3, fluent("name-min-length", min_length = 3))]`.
String,
);

Expand Down
5 changes: 4 additions & 1 deletion serde_valid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@
//!
//! You can also use [fluent](https://projectfluent.org/) localization by using `fluent` feature.
//!
//! Allow the following attributes:
//! - `#[validate(..., message_l10n = fluent("message-id", key1 = value1, ...))]`
//! - `#[validate(..., fluent("message-id", key1 = value1, ...))]`
//!
//! ```rust
//! # #[cfg(feature = "fluent")] {
//! # use fluent::{FluentBundle, FluentResource};
Expand All @@ -194,7 +198,6 @@
//! #[derive(Validate)]
//! struct Data (
//! #[validate(min_length = 3, message_l10n = fluent("name-min-length", min_length = 3))]
//! // Or Just `#[validate(min_length = 3, fluent("name-min-length", min_length = 3))]`.
//! String,
//! );
//!
Expand Down

0 comments on commit 78c607f

Please sign in to comment.