facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.63k stars 8.51k forks source link

[i18n] Making everything translatable (website title, description...) #4542

Open MisterFISHUP opened 3 years ago

MisterFISHUP commented 3 years ago

🚀 Feature

First of all, the i18n feature of Docusaurus is terrific, thanks a lot!

It seems that the website's title can't be translated. It's not a big problem if the website title is just a simple name or doesn't have much meaning. However, It's really not ideal especially when the website uses languages that use different alphabet: imagine the main language of the website is Chinese (or Hebrew, Thai, Russian, etc) and the website title is also written in this language, then all final html pages' title will contain this website title, even for pages written in secondary/other languages (English for example), which is a bit bad for viewers and SEO since the website title in the html title is almost unreadable.

Thus, I think it's a good idea to include the possibility to translate the website title in the i18n feature, to improve readability and SEO in the cases illustrated above.

Have you read the Contributing Guidelines on issues?

Yes.

Motivation

See above.

Pitch

It would be great if the website title can be translated just like how the navbar/footer/react code is translated: add translations in some json file in i18n directory. Or even better: provide the website title translation in i18n in docusaurus.config.js directly (maybe in localConfigs for example, with a optional field for website title translation).

PS. Still need to mention this again: thanks for the awesome i18n feature!

TODOs

slorber commented 3 years ago

Thanks for the feedback :)

This has been reported here too: https://github.com/facebook/docusaurus/discussions/4480

I was thinking of adding i18n/en/site.json or something, allowing you to provide title and tagline for example.

I think it's a better place to translate content, particularly when you have a long list of locales: not sure we want to maintain a lot of translations in the config.

But at the same time, I'd also like a locale to be able to "override" config setting somehow, just not sure what this API should look like and need to think more about this.

MisterFISHUP commented 3 years ago

@slorber Agree with you, and yes it is not evident how to design this API... Besides the title, it would also be nice to be able to choose different img (social share image preview) for different locales, since this image often contains the site title (and other words/sentences depending on the current locale). I also noticed the html in footer is not translatable. I can imagine some cases where the html contains texts depending on locales (ex: alt tag, title tag or just normal texts inside an element), so I think making it translatable would also be a good idea.

To sum up, here is a small list of untranslatable things I noticed: