eggjs / eggjs/egg

[RFC] egg-validate support i18n and auto load rule file

Open
#1,672 11 comments 3 reactions 1 assignee Claimed by @atian25 View on GitHub
type: proposals
Dominant language
TypeScript
Stars
19k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

## Background

Currently, [egg-validate](https://github.com/eggjs/egg-validate) don't support `i18n`:
- https://github.com/eggjs/egg/issues/589
- https://github.com/eggjs/egg/issues/1064
- https://github.com/eggjs/egg-validate/pull/7

## Proposal

### i18n
- `egg-validate` will use [egg-i18n](https://github.com/eggjs/egg-i18n) as `optionalDependencies`
- change [Parameter](https://github.com/node-modules/parameter)'s `translate` to `ctx.gettext` which provide by `egg-i8n`

### rule file

- auto load `app/validate/**/*.js`, and register to `app.validator.addRule(type, fn)`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.