egg-validate
egg-validate copied to clipboard
feat: support i18n and rules config
Checklist
- [x]
npm test
passes - [x] documentation is changed or added
Affected core subsystem(s)
错误信息输出支持 eggjs 中的 i18n
Description of change
parameter.translate 实现,并且使用 gettext 支持 app.validate 去掉 增加在 config.default 中配置 rules
Codecov Report
Merging #7 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #7 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 1 -2
Lines 9 14 +5
=====================================
+ Hits 9 14 +5
Impacted Files | Coverage Δ | |
---|---|---|
app/extend/context.js | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 5b7ade0...07966d3. Read the comment docs.
补充了 context 的测试
中文部分的测试已经补充
我把依赖包升级了一下,测试代码已经改过来了。 测试时发现升级后还是无法获取到 app.gettext
i18n 没有注册 app.gettext
吧,是在 ctx 上的
嗯,所以 validator 目前还是得绑定在 context 中而不是 app 中。这种情况下 this.validator.addRule这个用法好像意义不大。而且只能在 context 中
嗯,先这样吧,反正原来也是有 addRule
的,加载文件的后面有需要再另起 PR。
cc @eggjs/core 也 Review 下?
喔噢
发自我的 iPhone
在 2017年11月16日,16:40,cwfan [email protected] 写道:
@runfan commented on this pull request.
In config/locales/zh-CN.js:
@@ -0,0 +1,27 @@ +'use strict'; egg config 下面的文件是会合并的不是吗?我是希望这些翻译直接做为默认的中文翻译放到项目中:)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
那么,我关闭这个 PR 了
先留着吧,回头我在另一个 PR 中自动 close 也行。 不急吧?在搞 2.0 ing
@atian25 @dead-horse @runfan any progress on this?