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

多余的'default' 被插入了config.language队列中 #1967

Closed
zyzyz opened this issue May 20, 2016 · 3 comments
Closed

多余的'default' 被插入了config.language队列中 #1967

zyzyz opened this issue May 20, 2016 · 3 comments
Labels
bug Something isn't working

Comments

@zyzyz
Copy link

zyzyz commented May 20, 2016

在lib/theme/index.js中

24  var languages = ctx.config.language;
25
26  if (!Array.isArray(languages)) {
27    languages = [languages];
28  }
29
30  languages.push('default');

如果说原config里设置的language为一个,或是留空,第30行的代码是把default推进一个本地Array里。
但是当原config里设置的language是多个,第30行的代码会把default推进ctx.config.language中


假如_config.yml里是这样设置的

language: en

我在其他地方获取ctx.config.language结果为
en

假如_config.yml里是这样设置的

language: 
  - en
  - zh-cn

我在其他地方获取ctx.config.language结果为
[en, zh-cn, default]

这是有意的还是bug?

@Jamling
Copy link

Jamling commented May 30, 2016

呵呵,所以我每次都把default给删除掉

@Xuanwo Xuanwo added the bug Something isn't working label Jul 3, 2016
@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 3, 2016

应该确实是一个BUG

@stevenjoezhang
Copy link
Member

There is a discussion about it #1125
I'm closing this issue. Please join the discussion there :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants