Comments (10)
thanks. how did you end up supplying undefined value on the fist place? do you generate localized strings programmatically?
from jquerytools.
Simple test case is:
- Create a new validation function WITHOUT message;
- Populate message later with localize function.
As for your question I would say yes, validation messages are populated from server strings because of consistency on client and server side.
Also, I would like to say that in general not sure if switching languages on client-side, that validator plugin has now, is necessary functionality.
from jquerytools.
ok. thanks for the scenario. I have now pushed your change to github and will be public on v.1.2.2.
how would you change the language yourself?
from jquerytools.
I think it's better strategy to switch languages on server-side and to populate validator by this already localized strings. Such scenario grants consistency of error messages on both (client and server) sides.
You know, I saw client-side localizing of validation messages in another jquery.validate plugin that used before. It uses different implementation, but the idea is the same. And still don't understand if it's a necessary functionality.
from jquerytools.
the problem with populating a different kind of validator for each end user is mostly performance. It would be harder to combine validator with other tools to a single file and do minification and take advantage of the global cache (such as cdn.flowplayer.org).
I understand your point but for now the localization stays on the client side.
thanks!
from jquerytools.
I guess it may be misunderstanding here. Default messages for each rule (in english for most cases) always must be inside of js file on client side. But my opinion is that localizing strings is part of server's work.
I don't want to remove existing functionality, just interesting in what is the reason.
from jquerytools.
You can (and should) do the localization on the server side. However the way of doing it is now external to the validator.js by using the $.validator.localize() static method. In my opinnion this is a good way to do it. You can setup the validation in your site-globals.js file which can be generated dynamically depending on the language of the user.
from jquerytools.
Ok, now it's clear. The reason is performance and ability to cache error message strings. Thanks for the explanation!
from jquerytools.
and most importantly to cache the actual tools. when being served from cdn.flowplayer.org your end users may already have the right file on their computer.
from jquerytools.
yes, you are right.
After a little researching I think that the best solution for the topic is to generate html page with just 'script' tag where to put all localized messages and to setup cache header for it on server. This would be pretty easy and fast, because generating of several language-specific js files before deploying seems like not thsimplest way.
from jquerytools.
Related Issues (20)
- DateInput change function not working HOT 3
- The library do not have a license. HOT 4
- http://jquerytools.github.io/demos/tabs/index.html HOT 5
- It is not possible dowloand JQuery tools.... HOT 1
- Demo doesn't work: https://jquerytools.github.io/demos/overlay/apple.htm HOT 2
- Url Error
- destroy overlay onClose
- Tooltip wrong position with zoom css
- "rel" tag should not be used for overlay and other tools
- No HTTPS connection for the included <script> HOT 1
- Uncaught TypeError: Cannot read property 'msie' of undefined HOT 5
- [Validator] how to replace default rule with custom HOT 1
- Ajax demo broken...
- IE11 - Datepicker Overlay not closing after pick
- Is this project still active ? HOT 2
- Domain expired, CDN broken HOT 8
- jquerytools.org expired
- CDN doesn't work due to expiry
- Cannot download jquerytools from jquerytools.github.io
- event.handle is undefined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquerytools.