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

feat: support i18n and rules config #7

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

runfan
Copy link

@runfan runfan commented Nov 8, 2017

Checklist
  • npm test passes
  • documentation is changed or added
Affected core subsystem(s)

错误信息输出支持 eggjs 中的 i18n

Description of change

parameter.translate 实现,并且使用 gettext 支持
app.validate 去掉
增加在 config.default 中配置 rules

@codecov-io
Copy link

codecov-io commented Nov 8, 2017

Codecov Report

Merging #7 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          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%> (ø) ⬆️

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.

Copy link
Member

@atian25 atian25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没测试?

README.md Outdated Show resolved Hide resolved
app/extend/context.js Outdated Show resolved Hide resolved
test/fixtures/validate_form/app.js Outdated Show resolved Hide resolved
@runfan
Copy link
Author

runfan commented Nov 13, 2017

补充了 context 的测试

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
test/plugin.test.js Outdated Show resolved Hide resolved
test/plugin.test.js Outdated Show resolved Hide resolved
@runfan
Copy link
Author

runfan commented Nov 13, 2017

中文部分的测试已经补充

app/extend/context.js Outdated Show resolved Hide resolved
app/extend/context.js Outdated Show resolved Hide resolved
app/extend/context.js Show resolved Hide resolved
test/plugin.test.js Outdated Show resolved Hide resolved
test/validate_cn.test.js Outdated Show resolved Hide resolved
@atian25 atian25 changed the title 完善 i18n 和 rules 配置 feat: support i18n and rules config Nov 14, 2017
@runfan
Copy link
Author

runfan commented Nov 15, 2017

我把依赖包升级了一下,测试代码已经改过来了。
测试时发现升级后还是无法获取到 app.gettext

@atian25
Copy link
Member

atian25 commented Nov 15, 2017

i18n 没有注册 app.gettext 吧,是在 ctx 上的

@runfan
Copy link
Author

runfan commented Nov 15, 2017

嗯,所以 validator 目前还是得绑定在 context 中而不是 app 中。这种情况下 this.validator.addRule这个用法好像意义不大。而且只能在 context 中

@atian25
Copy link
Member

atian25 commented Nov 15, 2017

嗯,先这样吧,反正原来也是有 addRule 的,加载文件的后面有需要再另起 PR。

cc @eggjs/core 也 Review 下?

Copy link
Member

@atian25 atian25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runfan 辛苦了,我这边接手下这个 Feature 吧,整理了下 RFC:eggjs/egg#1672

config/locales/zh-CN.js Outdated Show resolved Hide resolved
@atian25
Copy link
Member

atian25 commented Nov 16, 2017 via email

@runfan
Copy link
Author

runfan commented Nov 17, 2017

那么,我关闭这个 PR 了

@atian25
Copy link
Member

atian25 commented Nov 17, 2017

先留着吧,回头我在另一个 PR 中自动 close 也行。
不急吧?在搞 2.0 ing

@JoaoCnh
Copy link

JoaoCnh commented Nov 13, 2018

@atian25 @dead-horse @runfan any progress on this?

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

Successfully merging this pull request may close these issues.

6 participants