Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update localization support to include form hints, validations and placeholders. #243

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hydra
Copy link
Contributor

@hydra hydra commented Jan 14, 2025

Recording.2025-01-14.142838.mp4

Notes for reviewers:

  • I'm not sure about many of the things I had to do to make this work, but it does indeed seem to work for the included example. Please review carefully.

@hydra
Copy link
Contributor Author

hydra commented Jan 14, 2025

I just remembered I still need to add placeholder localization support too. EDIT: Done.

@hydra hydra changed the title Update localization support to include form hints and validations. Update localization support to include form hints, validations and placeholders. Jan 14, 2025
@hydra hydra force-pushed the add-localization-support-3 branch from 7497c10 to f0f9ecc Compare January 27, 2025 10:46
@hydra
Copy link
Contributor Author

hydra commented Jan 27, 2025

rebased

@hydra hydra force-pushed the add-localization-support-3 branch from f0f9ecc to 34f63ce Compare February 4, 2025 17:27
@hydra
Copy link
Contributor Author

hydra commented Feb 4, 2025

rebased again.

Copy link
Member

@ecton ecton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the existing comments, it looks like this PR also needs cargo fmt to be run against it. Additionally I suspect running cargo clippy will return warnings that should be addressed too.

@@ -2927,6 +2928,15 @@ pub enum Value<T> {
Dynamic(Dynamic<T>),
}

impl<T> PartialEq for Value<T>
where
T: PartialEq + Clone
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't require Clone, and I also don't like that Dynamic's implementation of PartialEq is different than Value::Dynamic's PartialEq result. To me PartialEq should work the same for a wrapped value as the wrapper in this situation.

@@ -3604,16 +3614,16 @@ pub enum Validation {
/// The data is valid.
Valid,
/// The data is invalid. The string contains a human-readable message.
Invalid(String),
Invalid(Value<MaybeLocalized>),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a Value rather than just a MaybeLocalized? Have you made sure that everywhere this is used that the contained value is properly being tracked to ensure external updates invalidate where it is being used?

@@ -3675,15 +3685,16 @@ impl Validations {
/// The validation is linked with `self` such that checking `self`'s
/// validation status will include this validation.
#[must_use]
pub fn validate<T, E, Valid>(
pub fn validate<T, Valid, R>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this changed from E to R? E stands for Error, I don't know what R would stand for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants