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
Localize messages support #252
Comments
I think that a casual User not needed custome message. I propose that
It is very small start. |
📝 textlint will provide custom message by custom plugin/settings, maybe {
"localize":{
"rule-a": {
"message-id": "localized message"
}
},
{
"rules": {
"rule-a": true
}
}
} |
markuplint has localize function. const message = await messages(locale, 'error'); |
ESLint get It will help to localize message. |
I have thought about it and meta data for rule.
{
"messages": {
"id-a": "message a {key}",
"id-b": {
"ja": "メッセージ B",
"en": "Message B"
}
}
}
const meta = require("./textlint.meta.json");
export default function(context) {
const { RuleError, localize, report} = context;
return {
[context.Syntax.Str](node) {
const message = localize(meta.messages["id-a"], { key: "value"});
report(node, new RuleError(message));
},
[context.Syntax.Paragraph](node) {
const message = localize(meta.messages["id-b"]);
report(node, new RuleError(message));
}
};
}; Designdependency flow:
meta file:
message format: https://github.com/messageformat/messageformat depended on Intl. And, Node.js does not support full-icu by default Overlay:
application user can modify ProblemThis design is depended on location of |
Option Schema is related |
https://github.com/secretlint/secretlint/blob/master/docs/secretlint-rule.md |
stylelint support reporting custom message that is defined by user.
This feature is needed for textlint.
Because, I know that textlint is used in some web application and software.
These application require "custome message" feature I think.
Can someone has implementation idea?
Update(2018-01-21):
Goal
Primary, We want to support following cases.
messageId
s for testingOptional(if it is as possibe)
The text was updated successfully, but these errors were encountered: