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

make messagebox optional #53

Open
macrozone opened this issue Feb 7, 2017 · 2 comments
Open

make messagebox optional #53

macrozone opened this issue Feb 7, 2017 · 2 comments

Comments

@macrozone
Copy link

I use another translators, that can also do variable replacements and can translate a schema (labels) to a given language. It also sets all messages to the proper translation. For this I just used the messages-function on simple-schema 1 and on version 2 i now use schema.messageBox.messages({ en: i18n.t('simpleSchema')}) (where i18n.t returns an object with all messages).

However, I do not need the features of messagebox and in paticular i do not want to have the huge handlebars depencency. So i think it would be best to have messagebox completly optional.

It could be a function that you had to implement, like getMessage(field, errorType)

@aldeed
Copy link
Collaborator

aldeed commented Feb 7, 2017

I think this would be OK if someone wants to figure out a plugin package implementation.

@macrozone
Copy link
Author

macrozone commented Feb 13, 2017

maybe you can define messageBox as peer dependency, so that at least one could just override
messageForError(errorInfo) and throw an error if someone did not install messagebox and did not define messageForError-

Edit: you could do:

let MessageBox = null;
try {
  MessageBox = require("message-box");
} catch(e) {
  // messagebox not installed, use has to provide own implementation
}

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

No branches or pull requests

2 participants