-
Notifications
You must be signed in to change notification settings - Fork 80
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
Allow for default messages to be localized #40
Comments
Would be nice to have a default config option like errorText :) |
Oh, I see this commit c820761 but somehow can't seem to get it to work. It gives me an error: |
@sha256 can you maybe point us in the right direction here?? |
@kevinmu17, sorry I have been very busy lately. Please see the last 2 test cases from here: https://github.com/sha256/Pristine/blob/feature/i18n/test/locale.test.js |
Thanks for the reply! I'm trying to test addMessages now, but same result: Both examples below are not working :(
|
@kevinmu17, could you please double check if you're using the right lib files? |
Yes, checked my output and it says: "./node_modules/pristinejs/dist/pristine.js" |
I installed the plugin with NPM, it seems the code isn't on there. I crosschecked it with the files on github and addMessages is no where to be found. Does pristine needs an update on NPM? |
As I found the npm version and the last released version in github are not same file but npm package.json file saying same version. That is why 'addMessages' function is not available in npm version to be clear as I just checked. BTW, it's a nice library. |
Hello, I installed Pristine with yarn and I can't use setLocale (I need to set french verion for error messages) |
This repo is abandoned. a fix you can do is get the github repo link: pacakage.json "dependencies": {
"pristinejs": "git+https://github.com/sha256/Pristine.git",
}, |
ok, thank you for the help |
Hey @thomas-franz, thanks for the nudge and sorry for not maintaining it properly. I have just bumped the version and published to NPM. |
@sha256 thank you so much! Is there any way to buy you a coffee? :) |
Solved the problem in the local copy of node_modules in this way: Pristine.prototype.setLocale = function (locale) {
currentLocale = locale;
}; Pristine.prototype.addMessages = function (locale, messages) {
var langObj = lang.hasOwnProperty(locale) ? lang[locale] : lang[locale] = {};
Object.keys(messages).forEach(function (key, index) {
langObj[key] = messages[key];
});
}; |
This would be nice to be able to localize, or change, default errors message.
Maybe though the defaultConfig parameter ?
Thanks.
The text was updated successfully, but these errors were encountered: