hexo
hexo copied to clipboard
Default language
The theme I'm using has 3 files in the languages folder , default
, fr-FR
and zh-Hans
.
I need English (default) as my site language. Leaving the language
option in _config.yml
blank doesn't fallback to default (as I suppose is the expected behavior). iissnan/hexo-theme-next#57 has more details.
In the line lib/theme/index.js#L26 it isn't checked if languages
is null
before adding it to the array. Maybe the bug is here.
This happened to me as well, both with the default landscape
theme as well as the light
theme. It used the alphabetically-last language in the theme's languages
folder (zh-TW in this case). I had to set language
to 'default'
explicitly to actually make it use "default".
It should be simple to reproduce. Run hexo init
somewhere, run hexo server
, open your browser to localhost:4000, and boom, you have Chinese text in the sidebar.
Seems kind of hard to believe this has been unresolved for almost a year.
Agreed, I read in some comment that language
's default is en
.
This means the theme are incorrect in using default
as language name.
Maybe someone can help verify that?
In my case using default landscape
theme with en
lead to random language being picked up. Changing language to default
fixed all issues.
It turns out that it is (and probably was) still behaving "randomly", after adding a post I'm getting index page in second language even though I have in confg:
language:
- en
- cs
I'm getting cs
translation on main page (in theme I have copied a default.yml
file to en.yml
just ot be sure). This bug is quite annoying :disappointed:.
same issue.... random language everytime... so frustrating.
same...i need chinese,but it give me de.......
@weqeo set language in hexo _config.yml to zh-cn may solve your issue.
@NoahDragon thanks,i found that this bug only appearanced when i test in localhost,it's just show everything fine when i deploy it to my domain.
I still have this issue using the landscape theme and the main _config.yml language does not seem to influence the language being picked.
the strangest thing is, it's random! I use a gitlab runner on some docker image and for some reason sometimes it renders in french, the first language in my theme other than default. https://vblip.com
Did https://github.com/hexojs/hexo/pull/3069 + #3110 resolve this issue?
Maybe related #3654
This issue should have been resolved. I did a lot of tests on multiple languages today: https://github.com/theme-next/hexo-theme-next/pull/1391, and this problem has not been reproduced on the latest version of Hexo
@stevenjoezhang
What about writing a post about how to maintain a Hexo with multiple languages? Such as how to organize the source
folder, how to set Front-Matters for each post, how to configure permalink
& language
settings in _config.yml
.
@SukkaW
Yes, I am thinking about it. In fact, Hexo can do more for multi-language support. For example, to generate the homepage and archive pages separately for different languages, users must use a plugin like https://github.com/Jamling/hexo-generator-i18n, or override the default generator: https://github.com/ppoffice/hexo-theme-minos/commit/f0269850ab83fba1200457c40d9e59c49a027fe4 How about making the index / archive / tag generator all multilingual by default?
@stevenjoezhang
How about making the index / archive / tag generator all multilingual by default?
Sounds like a great idea! Since Hexo 5.0.0 is on the go, it is now or never.
How about making the index / archive / tag generator all multilingual by default?
instead of /tags/foo/
, /en/tags/foo/
is generated instead?
Yes, if the user sets multiple languages in _config.yml
, then multiple directories need to be generated separately:
/tags/foo/
(for default language)
/en/tags/foo/
/en/zh-CN/foo/
...
See also #1696, https://github.com/hexojs/hexo/issues/1450
A few months ago, theme NexT received a feature request about multilingual support: https://github.com/theme-next/hexo-theme-next/issues/1070 Users need a multilingual button for switching the website into different language version. This requires multilingual directories generated by Hexo.
I created simple hexo site with support multi language for post/pages/archives based on hexo-theme-minos, but ongoing language switcher and meta seo.
https://github.com/dimaslanjaka/hexo-multi-language
http://www.webmanajemen.com/hexo-multi-language/