jackyzha0 / quartz

🌱 a fast, batteries-included static-site generator that transforms Markdown content into fully functional websites
https://quartz.jzhao.xyz
MIT License
5.96k stars 2.37k forks source link

Multilanguage support per note #803

Open JaCoB1123 opened 5 months ago

JaCoB1123 commented 5 months ago

Is your feature request related to a problem? Please describe. Now that #462 is fixed by #738 (thanks @Lisandra-dev), I'd like to request an extension to it: It would be nice to have the option to have multiple languages on the same site. This would mean, that I can have pages in different languages and Quartz' UI would update to match the current pages' language.

Describe the solution you'd like Ideally I would specify the language in each note. Quartz should then build the UI based on the current notes' language. It also should filter displayed notes by the current language (e.g. in Backlinks, search results, ...). It should be possible to have a language switcher somewhere, which switches to the current notes' matching language version. If that doesn't exist it could fallback to the home page.

Describe alternatives you've considered Coming from Hugo I got used to having a folder per language. The files could then be named identical in both folders and Hugo would pick them up as being the same page in different languages. I'm currently using Quartz in this way, and the language folders clutter up my

Additional context I'm unsure if it makes sense to set UI to EN and still open a note in another language (e.g. when switching from a German note with no English translation to English). Maybe showing a fallback as in "No translation for the current page is available" would make sense?

ffrancoa commented 5 months ago

Second this

aarnphm commented 5 months ago

I guess the assumption here is that you also have notes in german?

One thing I can think of is to have notes prefixed with locale, should work with redirect and crawlinks afaik.

Doable, lets see what @jackyzha0 thinks of this.

adambrangenberg commented 5 months ago

For me personally, an ideal implementation would be if you would define the language in the Frontmatter and have an option to define a fallback-language in case nothing is defined in the Frontmatter. That would interfere the least with existing note-taking-systems.

ghost commented 4 months ago

I agree with this proposal. It stands to benefit not only Quartz users worldwide but also the Quartz project itself. It would facilitate the localization of the documentation, currently available only in English, thereby broadening accessibility.

HakuGuen commented 4 months ago

This feature sounds good, although it seems more logical to have the option to switch between languages with a toggle button, in which case the whole website switches and only includes the notes in the correct language. I don't see wikilinks between notes of different languages making a lot of sense.

rodrigoportela commented 2 weeks ago

Struggling with localization in a Quartz installation I'm testing and not being a developer but having tried to check the relevant parts of the code and issues/documentation, I was understanding or hoping that specifying a language code in ISO format in the YAML of a note with a "lang" key would not only make that the value of the lang attribute in the <html> tag (as it does), but it would also set that language as the one to use (if available in the localization files) for the texts of the interface when viewing that note in its published page as mentioned in this issue. So it doesn't seem to be the intended result. If it's not the intended result, could someone please explain how is it supposed to work, as I also don't see the interface language changing according to the browser language (which was the other possibility I was considering).

Sorry if this doesn't belong here. If that's the case, please direct me to an explanation elsewhere or what's the expected way to proceed.