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

[Feature Request]: Add a language-switch button in NexT #1680

Open
Gabirel opened this issue May 24, 2017 · 10 comments
Open

[Feature Request]: Add a language-switch button in NexT #1680

Gabirel opened this issue May 24, 2017 · 10 comments

Comments

@Gabirel
Copy link

Gabirel commented May 24, 2017

Expected behavior (预期行为)

希望可以像https://hexo.io 那样有个可以多国语言切换的按钮

现在支持这种开箱即用的主题好像没有,NexT能否支持呢?

虽然可以在文章里添加链接这种形式,但是过于麻烦了,官方能否支持一下?


English:
I hope Next could have a button like https://hexo.io to help users to switch languages.

Could Next support this since others themes don't have this kind of feature.

It is too inconvenient to add a link inside the articles though users could do it.


NexT Information

Add the ✔ sign before an item which is affected by this behavior.

NexT Scheme:

  • All schemes ✔
  • Muse
  • Mist
  • Pisces
@AlynxZhou
Copy link
Contributor

hexo.io那个是生成了多语言的网页放在了子目录?感觉这个跟NexT主题没啥关系……是hexo生成的问题吧,hexo一次只能生成一个语言的,主题应该改不了这个吧。

@Gabirel
Copy link
Author

Gabirel commented Jul 8, 2017

现在的hexo版本可以生成多语言目录,已经做到了(我博客现在就是有多语言的文章),就差NexT主题支持多语言切换按钮了

@Haocen
Copy link
Contributor

Haocen commented Sep 18, 2017

The multi-language support user asked for is actually a limitation of Hexo, not necessary this theme.

@Gabirel Gabirel changed the title [Feature Request]: NexT能否添加一个语言切换按钮以方便国际化 [Feature Request]: Add a language-switch button in NexT Oct 1, 2017
@Gabirel
Copy link
Author

Gabirel commented Oct 1, 2017

@Haocen What I mean is that it would be a awesome feature if there was a button for switching languages whenever visitors did that. Not just the multi-language support. I do know this feature was supported long time ago.
All I need is that a button for switching languages.

The official website of Hexo has already included this feature. However, it is not easy for us who use NexT to make it happen since NexT doesn't have any feature like this.

Like this:
image

Actually, I really want to do it by myself. But this is beyond my ability.

@ivan-nginx
Copy link
Collaborator

@AlynxZhou that's right, i want to do this, but always forgot. 😄

@stevenjoezhang
Copy link
Contributor

我不确定这个「多国语言切换的按钮」需要多智能?
举例用的 https://hexo.io 的按钮,在任何界面点击都会「回到首页」,而不是「跳转到与当前对应的页面」。

@Gabirel
Copy link
Author

Gabirel commented Mar 1, 2020

多语言切换需要的是可以对于当前页面直接切换,即「跳转到与当前对应的页面」。而非跳转到首页

其实已经有一些人已经实现了这样的功能。我之前收藏的URL,他们的域名都过期了,找不到了。如果找到了我会加进来。

@stevenjoezhang
Copy link
Contributor

我想你说的是这个效果: https://dengcb.com/zh/page/2/
Pull Request已经有了: theme-next/hexo-theme-next#1391
但是,Hexo默认的generator并不会为不同语言生成单独的首页和归档页面。你需要借助 https://github.com/Jamling/hexo-generator-i18n 这样的第三方插件,或者用不同的配置多次执行hexo g,否则「跳转到与当前对应的页面」可能失败:例如,只有中文归档页面,而没有英文归档页面,那么切换语言就会导致404 not found。这涉及到Hexo的核心功能,不是一个主题负责的范围,因此你需要自行解决。

@AlynxZhou
Copy link
Contributor

我补充一下,Hexo的多语言支持其实是很不完整的:虽然可以添加多个语言,但是各种自带生成器都没考虑这个,如果生成器没有规划好路径,主题就没法处理跳转。所以与其依赖Hexo建立多语言网站,不如建立多个Hexo站点,每个站点处理一种语言,然后将它们设置为不同的subdir,之后添加一个统一首页即可,然后自己修改一下主题添加链接。因为反正不管怎么处理,你都要编写多份不同语言博文,所以这样并没有太大影响。

@stevenjoezhang
Copy link
Contributor

是的,自带生成器没有考虑这个问题,主题要集成多语言,只能暴力改: ppoffice/hexo-theme-minos@f026985
期望 Hexo 在未来提供统一的接口: hexojs/hexo#1125 (comment)

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

No branches or pull requests

5 participants