Open ItayZiv opened 4 years ago
app.config.language
returns the language when it is explicitly defined (in conf.py or cli). It defaults to ""
.
I don't know if og:locale:alternate
is that useful. From a quick google search, it seems that only Facebook uses it. Even then, Facebook makes extra requests to the server with the parameter fb_locale
and expects a response that RTD does not support afaik.
It may be more useful to provide links to alternate languages in the form:
<link rel="alternate" hreflang="en" href="https://docs.wpilib.org/en/latest/" />
<link rel="alternate" hreflang="fr" href="https://docs.wpilib.org/fr/latest/" />
^ This is what Google Search uses to differentiate between languages: https://support.google.com/webmasters/answer/189077
That's something that we might be able to insert in extra tags on the per lang build, but not something that should be done in the extension. The language as configured by sphinx isn't the same format as defined by opengraph, it's be something you need to specify in conf.py per each lang build
We should be able to take advantage of READTHEDOCS_LANGUAGE for this
It’s not the correct format that ogp expects, it wants language_TERRITORY. Unless your talking about the link for google that was mentioned. Idk if that’s in scope for this being not very ogp? idk
It does indeed what language territory. However are locale codes can be used to lookup language territory.
I added support for this (the non-og meta version) directly into frc-docs a while ago. https://github.com/wpilibsuite/frc-docs/blob/main/source/_extensions/localization.py It can be upstreamed to this repo.
Not sure if this is possible, but if it is, then adding support for and changing the
og:locale
based on the translated version of the documentation would be nice if possible. Additional adding support forog:locale
andog:locale:alternate
would be useful anyways for non-English documentation and documentation who has non-English translations.