-
Notifications
You must be signed in to change notification settings - Fork 379
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
RequireJS and Knockout-Validation Localization #492
Comments
It dependes on your build environment. On way to do it is to preprocess the localization files and wrap them with define(['knockout', 'knockout-validation'], function(ko) {
//...localization file contents
}); If you're using gulp you can do this easily with gulp-wrap-amd plugin. I can see that it's not possible to use the localization files with RequireJS without wrapping them. I think the best way to fix this issue is to wrap the localization files similar to the way the library is. |
And do. Hoping that we can somehow connect a file with requirejs |
AMD usage example http://embed.plnkr.co/qCu23Cid0D4jlkndPvYy/preview Node.js npm install knockout
npm install git://github.com/Knockout-Contrib/Knockout-Validation#master var kv = require('knockout.validation');
// Helper method to dump each rule's message
function dumpMessages() {
Object.keys(kv.rules).forEach(function(ruleName) {
console.log(kv.rules[ruleName].message);
});
}
// Show the default messages
dumpMessages();
// Localize rules
require('knockout.validation/Localization/ro-RO.js');
dumpMessages();
// Localize rules again
require('knockout.validation/Localization/fr-FR.js');
dumpMessages();
// Reset to previous values
require('knockout.validation/Localization/en-US.js');
dumpMessages(); |
@davhdavh Don't forget to close this issue in your commit. Thanks. |
…een them The default localization is en-US and it's already included in the library. There's no need to load it explicitly from en-US.js. The following localization files have been renamed because their name was invalid: * no-NB.js → nb-NO.js * ca-CA.js → ca-ES.js Closes #492
How to use the localization files with RequireJS? Now I have to make my desired localization files into custom files.
The text was updated successfully, but these errors were encountered: