hexo icon indicating copy to clipboard operation
hexo copied to clipboard

Default language

Open dcardosods opened this issue 9 years ago • 18 comments

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.

dcardosods avatar Mar 20 '15 15:03 dcardosods

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.

kfranqueiro avatar Feb 25 '16 05:02 kfranqueiro

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?

leesei avatar Feb 25 '16 17:02 leesei

In my case using default landscape theme with en lead to random language being picked up. Changing language to default fixed all issues.

mnn avatar Mar 19 '16 17:03 mnn

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:.

mnn avatar Mar 26 '16 14:03 mnn

same issue.... random language everytime... so frustrating.

jbuddha avatar Apr 15 '16 17:04 jbuddha

same...i need chinese,but it give me de.......

weqeo avatar Oct 10 '16 09:10 weqeo

@weqeo set language in hexo _config.yml to zh-cn may solve your issue.

NoahDragon avatar Oct 10 '16 12:10 NoahDragon

@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.

weqeo avatar Oct 11 '16 06:10 weqeo

I still have this issue using the landscape theme and the main _config.yml language does not seem to influence the language being picked.

frumpel avatar Feb 21 '17 21:02 frumpel

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

FossPrime avatar Apr 07 '17 10:04 FossPrime

Did https://github.com/hexojs/hexo/pull/3069 + #3110 resolve this issue?

Maybe related #3654

curbengh avatar Sep 28 '19 07:09 curbengh

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 avatar Feb 29 '20 13:02 stevenjoezhang

@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 avatar Feb 29 '20 15:02 SukkaW

@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 avatar Feb 29 '20 16:02 stevenjoezhang

@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.

SukkaW avatar Feb 29 '20 17:02 SukkaW

How about making the index / archive / tag generator all multilingual by default?

instead of /tags/foo/, /en/tags/foo/ is generated instead?

curbengh avatar Mar 06 '20 00:03 curbengh

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.

stevenjoezhang avatar Mar 06 '20 03:03 stevenjoezhang

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/

dimaslanjaka avatar Jul 15 '23 13:07 dimaslanjaka