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

Expose formatting functions used for formatting error messages #275

Closed
wants to merge 2 commits into from
Closed

Conversation

jacobbuck
Copy link

Exposes 2 methods:

Backbone.Validation.formatFunctions.formatLabel(attrName, model)
Backbone.Validation.formatFunctions.format()

Useful for writing method validators or custom validators which use default messages.

@platinumazure
Copy link

Rather than jump into this, I'd like to discuss if it makes sense to unify standard and custom error message processing first.

To me it would be awesome if messages were all (under the hood) functions which take similar arguments to the validators themselves. Maybe strings with numeric formatting markers could be special-cased to invocations of the format function.

Exposing formatLabel isn't a bad idea, though.

Just my 2¢.

@jacobbuck jacobbuck closed this Feb 5, 2015
@jacobbuck jacobbuck reopened this Feb 5, 2015
@jacobbuck
Copy link
Author

@platinumazure I agree. But this is just a short term fix until that's a reality.

@chiefGui
Copy link
Collaborator

chiefGui commented Feb 5, 2015

What do you think guys about a Dictionary of messages?

@platinumazure
Copy link

@chiefGui What sort of thing are you thinking of? Care to write a quick example? (Pseudocode is fine)

@chiefGui
Copy link
Collaborator

@platinumazure you told:

[...] unify standard and custom error message processing first [...]

For me, it makes lots of sense. Same interface: a dictionary. Something like errorMessages.json with key:value design.

If you stop and think about it, it turns globalization way easier.

Can you understand my point of view?

PS: I am saying this for empiricism. Once upon a time I needed validation messages in multiple languages and I got frustrated to deal with since the native foundation doesn't give me a solid — and easy — way to go.

At last, do you really think we have to create an interface to release this PR?

@platinumazure
Copy link

@chiefGui It's probably okay to release this as is, sure. I just wanted to make sure the concept was discussed.

Let's move further discussion to a new issue. I apologize for leading us down the rabbit hole in the first place.

@jacobbuck
Copy link
Author

@thedersen any movement on this?

@jacobbuck
Copy link
Author

@thedersen bump

@jacobbuck jacobbuck closed this Aug 24, 2020
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.

None yet

3 participants